how do l link a combo box so it displays another field

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

Guest

Can anyone explain how l link a combo box so when l select an entry in the
combo list it will lookup and display
another field, what l want to do is when l select a customers name in my
form it will link to their address field
and display it automatically. I've tried looking through the help files to
no avail!
 
One option is to include the address field(s) in the combo box row source.
There should probably be several address fields unless you are just showing
the street or something like that, but for now here's a simplified version.
I will assume that People records are stored in a People table, and that the
combo box row source is derived from that table. I will further assume that
you have combined FirstName and LastName fields in the row source. In
design view for the row source query, add the PeopleID field (the primary
key for that table). At the top of an empty column (the second column) you
could put:
FullName: [LastName] & ", " & [FirstName]
Use the actual field names, of course. Add the address field to the third
column. Set the combo box column count to 3, the column widths to
0";1.5";0", and the bound column to 1. Adjust the column width of the
second column as needed. Set the control source of an unbound combo box
elsewhere on the form to:
=[cboYourComboBox].Column(2)
This is actually the third column from the combo box row source, as the
column count starts at 0.
Another way (it is probably a cleaner way) is to include the People table
(or a query based on that table) in the form's record source query. Design
the combo box as described, except you don't need the third (address)
column, so the column count is 2 and the column widths 0";1.5". Set the
Control Source of the combo box to PeopleID, and bind text boxes on the form
to the address field(s).
 
Back
Top