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

Linked combo box problem. 1

Status
Not open for further replies.

Migman01

Technical User
May 28, 2006
2
GB
I need 2 combo boxes called 'Car Make'(e.g Ford) and 'Model (e.g Fiesta), the problem is that I need the Model combo box to only display the models for the Car Make selected, for example: If the user selects Ford as the Car Make, the model combo box should then only display the Ford models for selection. Knowing how to structure my tables/queries will help.

This is probably very simple to do, but i'm new to the database stuff.

Thanks.
 
You probably have a table with fields [Car Make] and [Model].

On the Rowsource options of your comboboxes, you'll have something like:

SELECT DISTINCT [Car Make] FROM TableName WHERE [Car Make] is not null;

SELECT DISTINCT [Model] FROM TableName WHERE Model Is Not Null And city=Screen.Activeform![Car Make];

Then on the AfterUpdate event of your first combobox, you'll have something like:

Private Sub city_AfterUpdate()
Me![Model].Requery
Me![Model].SetFocus
Me![Model].Dropdown
End Sub

Substitute Table names and field names where appropriate.
 
Thanks a lot, fneily, that has helped me fix the problem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top