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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limiting Contacts in Combo Box to Selected Company 1

Status
Not open for further replies.

richo

Technical User
May 16, 2001
14
AU
I have designed forms that in several areas l need to input a contact name which l have a combo box for. What l want is for the list to only include contacts for that company, how do l do this?

Thanks in advance
 
I'll assume that the table with contacts is linked to the customer table. Add the customer table to the query the combobox is based on. Place the customer id field on the QBE grid and set it's criteria to the customer id field of the form(if the field isn't actually displayed on the form you'll need to add it, you can hide it by setting it's visible property to No. This is necessary as you are not addressing the field but a control). Then in this field's criteria use the following syntax to limit the list choices:

Forms!FormName!FieldName

In the combobox's Got Focus property requery the combobox:

...
Me.ActiveControl.Requery
...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top