Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to Show All Values in Combo Box

Status
Not open for further replies.

rl78

MIS
Sep 26, 2002
17
US
Hi All,
I have a combo box that shows two values when you click on it, however, when I select a value and move to another field, only one value stays. The field is a lookup and writes an ID into the table. Let me make this more easier to understand, I have 2 values in combo box, a person's name and their phone extension. I want the form to always display the extension along with the name and not just the name. Hope this makes sense.
 
You can add a text box that contains a DLookup expression like the following:

=DLookUp("[Extension]","tblEmployees"," [SelectedEmployee]=[Employee]")

This assumes that the source for your combo box is tblEmployees, the field in the table is called [Employee], the extension field in the table is [Extension], and that the combo box on the form is called [SelectedEmployee]

-Larry
 
Base your form on a one-to-many query. In the query include the key field from the many side and whatever fields from the one side (lookup) you want to appear on your form. Then, when you build your combo box using the wizard, link on the key from the one side and store it in the foreign (many) key field.

This way, the user will see whatever fields you want to display in your combo (e.g., name, extension) and the text fields (e.g., extension) will be filled in automatically on your form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top