DLOOKUP / Combo / Text Boxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a form with the combo box Name. This is linked to a table that
contains all customers details. When the name from the combo box is selected
I want the other fields of the table to appear in text boxes. All the options
I've tried come up #Error or #Name.

My table is
tblAddress

and my columns are

tblAddress.Name
tblAddress.[Address 1]
tblAddress.[Address 2]

etc ...

My comboBox is Combo24 and text box that I want address 1 to show in is Text33
 
Here is what worked for me:
I let the combo box look up along with the ID, the other required
information as well. But in the Column Size, I set the others to 0"; so only
the ID will show but the other information is a part of the Combo Box as
well. (Remember to set the Column Count to the number of columns you are
looking up as well).

Then in the Combo.Change()
Save the Combo.Column([column number], Combo.RowSource) to a variable.
Here the column number is the column number of the field you want to appear
on the form for the selected ID. Remember this is zero based, so if your
field is the 3rd column your column number is 2.

(This will select the particular field from the "matrix" represented by the
Column Numbers and the RowSource.)
This saved value can be displayed in a text box on the form by sending focus
to it and then once value is assigned sending focus back to the Combo.

I hope it works for you as well.
Good Luck.
 
Back
Top