Forms :: Populating Only Key Field Value Form Combo Box Selection?
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 Replies
ADVERTISEMENT
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 5 Replies
View Related
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
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
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
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
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
Nov 4, 2013
I'm building a test registration form, and I want to populate 2 additional fields based on the TestID ComboBox selection. This same TestID table has a Requirement and Expected result field, that I want to display for the end user, to make sense of the test in question. Multiple fields in the ComboBox does not work since you cannot select a single testID; you can click on the relevant testID, but the table remains in view, rather than displaying only the relevant testID.
View 7 Replies
View Related
Jan 28, 2014
I have a form which has a combobox where the user selects a record from another table,I want to hide the forms fields [managercontact] and [managertelno] depending on the value of the combobox (manager) from the table details, but its not the value shown in the combobox its the value of another field [type] from the same table called details. Its one of two values being 'conc' or 'ob'.
View 2 Replies
View Related
Jul 8, 2014
I have a form frmCrisisSupportWorkers with a tab control on the form. On the first tab, Personal Info there is a combo box called cboLocation. It is next to the Town/City.
I have a text box that updates the postcode after the selection is made below it but that is as the post codes are stored in the combo box and I just put the column for the postcode in the control source of the text box.
I can't do that for state as I have it stored in another table and use a numeric identifier to show which state is selected.
I want to have a text box below that auto updates the state once a town is selected but I can't seem to get it working.
View 14 Replies
View Related
Mar 11, 2015
I'm creating a form that when the user selects the following categories in the same combo box (Date Received, Date Reviewed, Date kitted, In Work, Complete) it auto populates dates in the respective fields. As I mentioned, it's only one combo box. The dates will be spread out, so the user will change the combo box selection based on when these events occur. I already have a field for each category both on the table and form. Also, I do have multiple tables for other parts of data, but these categories all fall into the same table.
View 8 Replies
View Related
Mar 17, 2014
I have two forms linked together.
frmMaterialRequest
MaterialRequest
Status
frmHandledBy
MaterialRequest
HandledBy
What I want is to meet the following:
- Form 2 to be locked but its "MaterialRequest" is enabled.
- HandledBy to be unlocked if the MaterialRequest meets the "Status" of "frmMaterialRequest" which is "Approved".
View 9 Replies
View Related
May 26, 2013
I have "donations" form with a cbo called "DonationType".
(frmDonations.DonationType)
General
Employee Match
Employer Match
Angels*
Friends*
Royal Crown*
The last three options need to redirect the user to a different form used for pledged donations.
View 2 Replies
View Related
Feb 14, 2014
I have a form that I populate after making selections in two combo boxes but when I load the form the text boxes are already filled in with the first record. The combo boxes load blank, which is what I want.
How do I get the rest of the form to be blank on load? It is made up of text boxes and check boxes that are all bound. Will this only work if they are unbound?
View 7 Replies
View Related
Jun 21, 2015
I have been looking some information on changing image based on form combo box selection on form.
I manage to do case by case but i need it in a simple code because their will be many employees just to avoid adding case by case code for each one.
Private Sub Emp_IDCombo_AfterUpdate()
Select Case Emp_IDCombo.Value
Case "AM-001"
Imageholder.Picture = "C:UsersAMGDesktopam-001.jpg"
Case "AM-002"
Imageholder.Picture = "C:UsersAMGOne DocumentsHR & Admin DatabaseEmployee Picturesam-002.jpg"
End Select
I have employees table where all images location is saved in text field and i have a combo box on form which is employee id.
Tables relationship
Employees_table [PK] to Contracts_table [FK] via field name {emp_ID}
Fields Name
Combo Box name on form Emp_IDCombo and row source is SELECT Employees_table.Emp_ID, Employees_table.EmployeeName, Employees_table.Emp_Pics FROM Employees_table;
Text field is located in employees_table called [Emp_Pic] for images location.
View 10 Replies
View Related
Jan 14, 2014
I have a combo box called Combo9 in form NavigationF, the combo box displays the results of FollowUpQ Query. What I would like to do is when the user selects a row from the combobox is closes NavigationF and opens ContactHistoryF and goes to the record selected in the combo box. I have made sure that the combobox contains CustomerID which is the primary key for my table.
View 4 Replies
View Related
Sep 15, 2013
I've been trying to populate a field in a form with information, but only if the field is blank.
What I am trying to do is this.
I have a continuous form displaying all of our principals, however when our principals are on leave I want to populate the field with the "acting principal". I have set it up so the field grabs the acting principal first but it is blank for several schools. For these schools where there there is no "acting principal" I want it to grab the substantive principal automatically and populate the field.
I have tried Is Null, Is Not Null, NZ, IF, Where and Then statements but to no avail.
View 10 Replies
View Related
Feb 5, 2014
I am creating a training database and first I have tables in relationship to the courses:
tbl_Courses
Course ID (Primary Key)
Course Title
Objectives
Instructors (lookup field allowing multiple instructors to be selected, meaning they are skilled to teach the course)
tbl_Instructors
Instructor ID (Primary Key
Last Name
First Name
Full Name (Caluclated to put Last Name, First Name)
[code]....
What I am trying to do on a form to create a new event is once the user selects the Course from the Course ID combo box, then I need the Instructor combo box to only display the instructors who are skilled to teach the course which are selected in the tbl_Courses.
I can get all Instructor ID's, but not the names and the class that has multiple instructors show on one line.Should I have not put the Instructors field in the tbl_Courses? Do I need another table for instructor skills or something?
View 1 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
Jul 18, 2013
I have a Customers table and an Orders table. My Customers table is a bit different than the norm because I couldn't figure out any other way to do this.
My client's customers are either businesses (companies) with a contact person, or individual customers. So, in the Customers table, I have the following fields (there are others but do not apply to my problem):
Customer ID
Company
Contact
Customer
So, if it is a company the data entry person would enter the company name and the full name (EX: Doe, John) in the contact field, but if it is an individual customer, then they would leave Company and Contact blank and enter just the Customer name (Ex: Doe, Jane).
So, in the Orders table, I have combo boxes for look ups for the fields Company and Customer.
That works okay, but I would really like for the Customer ID to post into a text box once the Company or Customer has been selected. In other words, the input person would enter the name, then it would show that Customer's ID #.
View 1 Replies
View Related
Apr 28, 2013
I am trying to populate a textbox based on selection from combo box. Both fields are in two different subforms within the same form.
I do see the selection from the combo box fills via debug. I don't see a value in the textbox.
This is the code I am using:
Private Sub cboRequestedItems_Change()
Me.PricePerUnit.Value = Me.cboRequestedItems.Column(1)
End Sub
View 6 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
May 8, 2007
Good day,
I have a main form with project data and a sub form that has related financial information. Once the user selects a particular project from the ProjectType drop down box, a field called Project Codes in the subform should be populated with only project codes for that particular Project Type.
Can someone assist?
Thanks
View 5 Replies
View Related
Oct 27, 2014
I am designing a nomination form (web database so no vba macros can be used).
The form has 3 combo boxes: cboStaffName, cboLevel, cboNominee.
The form is bound to the tblSubmit table where the submissions are populated.
I used a select statement:SELECT Staff_List.Staff_Name FROM Staff_List; to populate the combo box for the Staff Name selection.
This is the select statement to populate the job level combobox:
SELECT Staff_List.Level, Staff_List.Staff_Name FROM Staff_List WHERE (((Staff_List.Staff_Name)=[forms]![frmtest]![cboStaffName]));
The select statement to populate the combobox for the nominee combobox:
SELECT Staff_List.Staff_Name FROM Staff_List WHERE (((Staff_List.Level)=[forms]![frmtest]![cboLevel]));
The problem is that the staff_name in the first combobox is still found in the nominee combobox which should not be because a staff cannot nominate self. There is a field in the Staff_List called YesNo that should be activated for each staff that is selected so that the select statement on the nominee combobox can be updated accordingly to remove items with the field "Active"
How to get the checkbox selected for each corresponding staff.
Sample of the database has been attached.
View 4 Replies
View Related