Populating A Text Field From A Combo Box Selection.
Apr 28, 2005
I have a combo where the list is populated with a bit of VB code to create a two field list. When the user selects the item they want from the list it displays the item in the combo box and should populate a text box in the same row with the value from the second column.
This combo is part of an orders subform and the user is selecting a product from the list which displays the product_name and the product_id.
The problem is that the product_id is not filled in and access returns the following error:
Run-time error ‘3101’:
The Microsoft Jet database cannot find a record in the table ‘product_table’ with key matching field(s) product_id.
This is the VB code that populates the list :
[code]
Private Sub comboCatagory_ID_AfterUpdate()
Dim sProd_description As String
sProd_description = "SELECT products_table.product_id, products_table.prod_description " & _
"FROM products_table " & _
"WHERE products_table.prod_catagoryID = " & "'" & Me.comboCatagory_ID.Column(0)
Me.comboProd_description.RowSource = sProd_description
Me.comboProd_description.Requery
End Sub
[end code]
What am I doing wrong?
Thx
Kev.
View Replies
ADVERTISEMENT
Nov 13, 2006
Probably an easy one here...I have a series of cascading combo boxes where once the last once it chosen, I'd like some sales info to populate in a group of text boxes. What command would I use for this?
Also, I have a checkbox that I'd like to use to either enable or disable a textbox as well. Any ideas?
Thanks!
View 12 Replies
View Related
Aug 10, 2015
In the Contacts Table there are two fields, the unique Contact ID key field numeric and the Contact Name. Like this:
Contact_ID; Name
1; Tom
2; Dick
3; Harry
In a form named "Selection" there is a Combo box that references the Contact table, and lists just the three names in the drop down (showing the Contact_ID is optional - I'm fine either way):
Tom
Dick
Harry
When the selection is made it will populate the field Contact_Ref the table called SelectedName.
Question: When the user selects the name I'd like the data populated in the SelectedName table to be the Contact_ID Value, and not the Name, so if Harry is selected the Value "3" would be saved.
View 3 Replies
View Related
Sep 9, 2014
In the database attached I have a form called from Candidates.In this form is a combo box where a user can select what company the candidate belongs too.
However some candidates are Private Individuals (do not belong to a company).Therefore, I want the Position field to be set to 'n/a" by default if 'Private Individual' is selected.
View 9 Replies
View Related
Jul 20, 2014
I can't quite get my code right for populating one combo box based on the selection in another. I didn't create this Access database but I've been asked to add in a second combo box that is based on the selection of the first combo box.
My first combo box is for Rohe (the location of the Maori tribe) and the second is Iwi (the tribe name). So my first combo box (Rohe) has Dvic_ROHE written in the control source and its row source code is:
SELECT tblLookUpValues.DatabaseFieldValue
FROM tblLookUpValues INNER JOIN tblFormQuestionLookUp ON tblLookUpValues.LookUpID = tblFormQuestionLookUp.LookUpID
WHERE (((tblFormQuestionLookUp.FormID)=2) AND ((tblFormQuestionLookUp.QuestionNumber)=75))
ORDER BY tblLookUpValues.DisplayOrder;
The combo box for Rohe (tribe location) is populated by a table named tblLookUpValues. The second combo box for Iwi (tribe) has Dvic_Iwi in the control source. I created a table named tbl_Rohe_Iwi_lookup that contains ROHE (a list of tribe locations) and IWI (the tribes). There are 12 tribal locations and another 10-14 tribes in each location.
The form that the Rohe and Iwi combo boxes are located on is called frmDeceased. This is the code that I attempted to write so that the second combo box (Iwi) is populated with only the tribes that are in the Rohe (location) that was selected from the Rohe combo box. But when I run the query it comes back with no results.
SELECT distinct tbl_Rohe_Iwi_lookup.Rohe, tbl_Rohe_Iwi_lookup.Iwi
FROM tbl_Rohe_Iwi_lookup
WHERE (((tbl_Rohe_Iwi_lookup.Rohe)=[forms]![frmDeceased]![Dvic_Rohe])) UNION select distinct null, null
FROM tbl_Rohe_Iwi_lookup
ORDER BY tbl_Rohe_Iwi_lookup.Iwi;
View 5 Replies
View Related
Dec 10, 2013
Autofill text field using combo box selectionHello,
I'm trying to autofill a field on a form using MS-Access 2010 Web version sharepoint using macros without coding.
The form has an existing Combo Box field called Segment, using the row sources "REW", "WTT", "DBM".
A user begins filling out the form and eventually selects the Combo Box for Segment and selects any one of the segment no Multiple selection
There is another text field, which is actually alpha-numeric, called Job_No. I want this to autofill based on their Segment selection, using this format:
REW-YYMMDD-TTTT, or REW-131210-20001 for example, for today with the time displayed as military time and last Job No.(20001) for REW and Also for WTT (30001) as starting number.
View 1 Replies
View Related
Jun 27, 2014
I (will have) a form which a user fills in to enter new data.
I have two fields,
"Branch" and "Branch ID" (Branch ID will not be on the form, just in the table)
Branch will be fed by a combo box with seven choices. I would like it so that when "Branch" is populated it autopopulates Branch ID with a code which relates to the branch, so for example
BRANCH BRANCH ID
Braintree BRA
Colchester COL
View 4 Replies
View Related
Sep 26, 2005
I need help to populate a certain selection from a drop-down (combo box).........OK I have a field named REP ID/REP NAME....(Rep stands for contractor)....Each Rep is assigned an ID and the first two numbers in the rep ID correspond to the territory in which they sell products...So for example 5830 John,Smith the 58 would be Northern California....Now what I want to create is a field named TEAM which would consist of Team A through Team D....Every Team is associated with different territory numbers to lets say I click 5830 John, Smith I would want Team A to automatically be populated in the TEAM field....Someone please helpp....And I hope I described it correctly
View 1 Replies
View Related
Oct 29, 2013
I have a table of raw materials that have two fields, their stock code and longer description.
I have another table that is tracking the usage of these materials. I want both the stock code and longer description to be recorded in the usage table.
I want the "Description" field in the usage table form to auto populate when the user selects the corresponding stockcode from a combobox.
View 3 Replies
View Related
Jul 19, 2006
Hi All
Been having trouble setting up a combo box in a form that displays data from the same line in the table into a text box.
I am trying this with a memo field without any luck. I am using a 2 column query for the combo box, the first column contains the name and the second contains the requirements (memo).
I have put in the after update code:
Private Sub CustName_AfterUpdate()
Me!CustReq = Me![CustName].Column(2)
End Sub
Can anyone please shed light on what I'm doing wrong?
Thanks
View 3 Replies
View Related
Nov 18, 2004
Hello,
This is my first time posting here and I hope someone can help me. I am not experienced with coding in access and only recently started using forms.
I am trying to create a text box that automaticly fills in once a selection is made in a combo box.
There are only 2 tables and 1 form I am working with. Table 1 has columns "code" and "bu". The second table has several columns, all blank, that the form fills in.
The combo box is working correctly, it displays all the "code"s. Once the code is selected I would like a text box to display the "bu" column.
Any suggestions are much appreciated.
View 4 Replies
View Related
Sep 29, 2005
Hi, I'm in the process of building a program in access 2003 for estimating roofs, I've ran into a little problem, as described below. any suggestions would be very useful
Populating the text box’s that relate to the chosen combo box’s with the sum of a calculation.
In other words if X combo box is chosen (There are many combo boxes to choose from) populate xx text box with the sum of a calculation.
Refer to the print screen example of my program: http://www.roofmart.net/Rest.asp
Notice under the label felts the 15lb 36” felt combo box is chosen and it displays the value of 11 and next to the combo box is a text box that displays the value of 25 The calculation will be (11*25) = 275 this value of 275 must be added to the text box values that are being shown in the forms header under 30yr where it reads $4,606.80 and 40 yr $6002.80 only, this is because the 30yr comp and the 40 yr comp combo boxes are the only chosen roof types under the label roof types above the felt label.
Hopefully this makes sense.
Thanks -- Any help with be greatly appreciated.
View 3 Replies
View Related
Nov 19, 2013
I have a text box that displays a name of a law from one table, based on that law name I want to populate a combo box with different options on how to comply with that law that come from a different table. The compliance options I need to pull in are different for each law. Finally I would like to have the selected option saved in the table the laws are coming from.
I have tried using a rowsource query [Form]![form1]![Law] for the combo box of law options but keep getting errors.
View 3 Replies
View Related
Dec 14, 2004
I have two questions.
I have a form with 2 combo boxes. The first pulls from a simple list. Once you make a choice, the second combo box is then filtered by the first. This works correct, except that once a choice is made in the first, the filter is locked. If you change the first combo box's value a second time it does not effect the second box. The query that I am using for the second combo box has two columns that pull the first 50 characters of a pair of memo fields. Quote: SELECT MSSS.SS_ID, Left([Application_Name],50) AS Expr1, Left([Description],50) AS Expr2, MSSS.Site_Code
FROM MSSS
WHERE (((MSSS.Site_Code)=[Forms]![Edit or Delete Requests]![Combo6])); These fields are then used to populate 2 text fields using an event procedure. Quote: Private Sub Combo10_AfterUpdate()
' Display Partial Application Name and Description based on choice
Me!txtApplication_Name = Me!Combo10.Column(1)
Me!txtDescription = Me!Combo10.Column(2)
End Sub This is working fine, but it starts the next problem.
I need to change the form to include the entire memo field into a text box. I was using the columns of the second combo box to fill them in. Since the combo box is limited to only 50 characters, i could only grab part of it. I am guessing there is a much better way to accomplish what I need, but I am too inexperienced with forms and vb to come up with it. Below are the fields I need from table MSSS
Business_Name
Application_Name
Description
Acronym
Level_1_Support
Level_2_Support
Escalation_process
Troubleshooting
Priority
Links
Modified
Disabled
Thanks in advance to any help!
View 5 Replies
View Related
Nov 28, 2014
Now I have a combo box "cbo_items" and a text box "txt_selectedItems", I want to populate text field with items selected from the combo box, every time i select an item it appears in text box and to be separated with comma, so text box appears like this ( item1, item2, item3), and after finishing the whole thing the result appears in lable "lbl_result" as "total items selected: 3 items".
View 1 Replies
View Related
Aug 14, 2015
The main issue I'm having is trying to populate a text box based on a combo box selection. I've found threads on that - the twist that is throwing me for a loop is that I'm dealing with two different forms.
I have a main/welcome form with two combo boxes on it. Based on the user's selections in these two combo boxes, two different forms are opened for data entry. For instance, box 1 has A, B, C and box 2 has x, y, z. If a user chooses B and z, then form B and form z are opened. What I want is for a text box to be populated on one of the opened forms, not the same (main/welcome) form. In other words, when B and z are chosen, I would like there to be a textbox autofilled with "z" on form z.
View 2 Replies
View Related
Aug 19, 2005
I'm pretty new to this type of programming and i was hoping for a little help,
I have completed the majority of my program it's just a few little things i need to tweak.
The main thing is that i am trying to get a text box to autofill from a selection in a combo box i.e.
i have selected a drop down box with 3 coloums looked up from another table i would like 1 of the columns to stay in the combo box after selection and the other two to appear in the text boxes on the same page.
Any help would be much appreciated.
thanks
Brad
View 6 Replies
View Related
Dec 31, 2014
I am trying to auto populate the text boxes in the form based on drop down from the combo box. As you can see in the form Frm_Input, this works fine for FL, but for some reason it will not populate for Skill, Role, FLM and Location. The table it is linking to is Tbl_Names. Why as I have changed the column source?
View 8 Replies
View Related
Aug 21, 2012
So I'm working on an Access 2007 application for my company's suppliers list, but I am restricted to using a single Excel worksheet for the back-end. One of the fields, called [Files], is a list of files in .pdf format related to a supplier. The number of files can be 0, 1 or many. I currently have this field set up so that each file is separated by a semi-colon. A sample first record in [Files] is:
K:Users est user2008-12-24-ASTM D5857-08.pdf;
K:Users est user2012-03-12APCPP25-Black.pdf;
K:Users est userDIN_16901.pdf
The front-end contains a multi-item form. I'm trying to add a ComboBox (cboFiles) for each record, which is populated by the value in [Files]. Then, selecting an item in the ComboBox should automatically open that file.
I've tried a few approaches so far for populating the ComboBox:
Setting [Files] as the Control Source results in a single item appearing as
"K:Users est user2008-12-24-ASTM D5857-08.pdf;K:Users est user2012-03-12APCPP25-Black.pdf;K:Users est userDIN_16901.pdf"
I also tried setting the ComboBox Record Source Type to Value List and created a hidden TextBox (txtFiles) with the Control Source set as [Files]. Then I used VBA in Form_Load to equate the ComboBox Row Source to the TextBox. The code is simply:
Code:
Private Sub Form_Load()
Me.cboFiles.RowSource = Me.txtFiles
End Sub
While this does create a ComboBox with the correct items for the first record, it also populates the ComboBox for all the other records with the same thing, ie. every ComboBox has the items:
- K:Users est user2008-12-24-ASTM D5857-08.pdf
- K:Users est user2012-03-12APCPP25-Black.pdf
- K:Users est userDIN_16901.pdf
I'm thinking maybe this approach could work with some modification in the code or approach. Unfortunately, I'm not too clear on why the code goes through all the Me.cboFiles.RowSource, but only once on Me.txtFiles or how to get it to check the txtFile for each row. Otherwise, I will need to figure out some other way to fill in the ComboBoxes.
Edit: Actually, I've noticed something peculiar. Each time I select an item from a ComboBox, the other ComboBoxes for the other records also change to the same item. I think this has to do with cboFiles being unbound. Changing it to bound doesn't seem to be quite right though as it just gives the same default values as txtFiles while the items are still just copied from the first cboFiles. Also, I can't actually select any of the items when it's bound. I imagine it might have to do with the read-only attributes of a linked Excel File.
View 6 Replies
View Related
Apr 26, 2012
I have a combobox on my form with fields related to it (ie. when an option is chosen in the drop-down, the next two fields are also populated with data based on the selection made - I know this is duplication of data, it's just the way the 'powers that be' wanted it. I'm changing it in my next version of the database!)
The two fields that are populated as a result of the selection in the combobox are migrating into the related table fine, but the actual selection in the combobox isn't - it's showing up as blank in each new record in the table.
View 4 Replies
View Related
Nov 27, 2005
I'm new to access. Hope someone can offer some help!
I have created a simple database to better organise some day-to-day office data management. For instance, I have a form (just) to record event attended by staff. The data would then be output as a brief report on overall office activities. Since it's event-oriented, staff attendance is just one complementary information. I went through most of the post re multi-select. I understand that it may not be a good idea to return values from multi-select list boxes into a text field, as it would be problematic for using data-analysis in the future.
In my case, I just need to have a text box, neatly (and easy for user, too) shows who attended. As suggested in one of the posting, I follow the instruction of http://support.microsoft.com/default.aspx?scid=kb;en-us;210203. But it doesn't seem working. I attach my databsae (sorry, it's very simple, as I want to test whether the multi-select work).
Your help would be greatly appr:confused: :confused: :confused: ciate!
Also, what about if I group option button, will it allow multiple return by the way?
delamerbleu
View 2 Replies
View Related
Jul 24, 2014
I am trying to populate multiple text boxes from combo box using one table. First text box is getting populate on base of combo box value while 2nd text box is not getting populating.
I have used the following to populate the text boxes, even row count is correct, But why is not 2nd text box is not populating ?
=[Combo2].[Column](1)
=[Combo2].[Column](2)
One thing I noted when I provide the control source then selection gets stop from combo box...I am giving the valid control source is customerID but its not working.Could it be the reason ? Why selection gets stop from combo box when provide the control source ? If remove the control source then 1st text box is getting filled on basis of combo selection and 2nd text box value is not getting filled as describe above.
View 1 Replies
View Related
May 24, 2013
I have two tables: tblWeightTickets and tblWasteType.
I want to create a form: frmWeightTickets, where a user can enter information and the data is stored in tblWeightTickets.
There are two fields in particular that I am working on ... "WasteType" and "Rate".
On the form, I want "WasteType" to be a combobox "cboWasteType" and when I select a type of waste I want the "Rate" textbox on the same form to auto populate with the rate amount for that particular type of waste (i.e. recycling, garbage, etc).
The Rate amount is located in the table: tblWasteType under the field name "Rate". How can I do this and at the same time store the information in the tblWeightTickets? I already have the combo box loaded with the types of waste - I just need it to populate the rate text box and store it in the Weight Tickets table.
View 11 Replies
View Related
Aug 3, 2015
I have a report based on a query. I want to populate 6 Text Boxes with Dates from fields in another query. The date fields I want to add will be headings for columns that represent weeks (they change all the time so can�t be hard figures). The two queries are not really related by any common field. I am not able to get this working because the fields I want are not part of the query that is the Record Source for the Report.
Is there any way that I can do this? Can I change the record source of just the text boxes?
View 5 Replies
View Related
Jul 27, 2005
Hi all,
I am fairly experienced with Access but am stumped. I have a table with a primary key ID field, product name, and product price. On an order form, I want to select the product from a combo box and have that product's price automatically populate a text box beside it for further calculations. Any help would be much appreciated, thank you!
View 14 Replies
View Related
Feb 28, 2008
Hi,
Im trying to get one of combo boxes to update a field automatically.. There are two choices in this combo box "Gatwick" and "Woking" what i need is when one is selected the JobNo field will update itself to GWO-(the first Unused JobNo) Ive used some VBA to make atleast the GWO- or WWO- appear and it works, but i have no clue as to how to get the next unused order number to appear after it.
This is what i have so far:
Private Sub JobLocation_AfterUpdate()
If Me.JobLocation = "Gatwick" Then
Me.JobNo = "GW0-"
Else
Me.JobNo = "WWO-"
End If
End Sub
Any help would be greatly appreciated.
Cheers
Marc.
View 4 Replies
View Related