How can I populate the textboxes with the values of a record that I selected in the combo box?
This is the code I wrote
Private Sub Combo2_AfterUpdate()
Dim intI As Integer
For intI = 2 To 8
Me("txtbox" & intI) = Combo2.Column(intI)
combo box works but the textboxes are blank.
I want to fill the values from the record selected in the combo box to the appropriate textboxes, starting with third field to ninth field. I hidden and bound the first column but is displaying the second column in the combo box.
These are the fields in my tblVendor:
Vendor - text (combo box)
Address - "
City - "
.. .and so on
Combo boxes use the 1st column normally to store the record ID.
1Base the form on a query using the combo box as the data criteria and requery the form on combo box update.
2Alternatively, change the form to a sub form and hook the sub form to the combo box, requerying the sub form on the combo box update method.
3Alternatively set the record source of the form using SQL in the update event of the combo box, using column(1) or column(0) (I get mixed up) as the record criteria and requery the form.
4Run a recordset query on the combo box update event.
The method you choose is up to you, but Access typically provides six or seven different ways to acheive similar outcomes. For straight searching I like form based on queryrequeired from combo box, less code to write, has to be better.