Full Version: Populating data based on another value in form
UtterAccess Forums > Microsoft® Access > Access Forms
Basic question (very similar to a previous question). I have got 1 combo box in a form for supplier name; have got another text box in form for supplier code. Dependent on what i select in combo box, how do i make the text box populate? For eg if supplier name is ABC enterprises and their code is S1001, how do i make the text box reflect S1001 when i select ABC in the combo box. The data that is used in the selection is in the "suppliers" table, and whatever info is entered on the form gets stored in the "Purchases" table. Please help....have tried different things which dont work. cryhard.gif
Jack Cowley
Welcome to Utter Access Forums! -o!
You only need a combo box based on your supplier table. The SupplerID is the bound column in the combo box and the Supplier name is shown. When you select a supplier from the combo box their SupplierID is saved to the table the form as based on as the combo box is bound to SupplierID in that table.
I hope that make sense... Here is a step by step...
1. In your form create a combo box using the wizard.
2. Select Supplier table and select SupplierID and SupplierName.
3. When asked by the wizard what you want to do with the value selected SupplierID from the combo box shown in the wizard.
That should do the trick... You do NOT want to save the SupplierCode in the Purchases table, but if you want to display it you can, but do not save it! To show the SupplierCode I will assume you added it to the combo box when you created it. Let's assume it is in the 4th column in the combo box. In the combo boxes After Update event enter code like this in the Event Procedure:
Me.NameOfSupplierCodeTextBox = Me.NameOfComboBox.Column(3)
That is not at typo as columns start at column 0
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.