Form to filter multiple criteria

morganth

New member
Local time
Today, 10:44
Joined
May 2, 2014
Messages
4
Hi there - sorry for what is such a basic thing!

I have a large table with information about different cars, called "Car Metadata". In this, each car has a unique identifier ("Car Code"), the make ("Manufacturer Name") and the model ("Short Model").
What I want to do is create a form with dropdown menus.
I have a first combo box with all the makes in the Metadata table.
What I am having trouble with is that I want a second combo box underneath which would only show the models which correspond to the make selected in the first box.
E.g. someone could select Ford in the top box and the second box would only show Fiesta, Focus etc.
Once it has done that I want it to be able to write the Car Codes for the records which match up to the make & model selected to a new table. Just to complicate things further, there can be multiple records with the same make and model but different Codes, I want all these multiple codes to be written to the final table.

Thanks - hope that all makes sense!
 
So just to clarify:

[cboBrand] |--- Filters --> [cboMake] |--- Filters --> [cboModel]
 
There isn't a top level Brand, just [cboMake] |--- Filters --> [cboModel]
e.g.
Make = Ford
Model = Fiesta

morganth
 
Code:
Private Sub cboMake_OnChange()
      cboMake.RowSource = "SELECT DISTINCT make FROM cars WHERE make = """ & cboMake.Value & """"
      Me.RowSource = "SELECT * FROM cars WHERE make = """ & cboMake.Value & """"
End Sub

Private Sub cboModel_OnChange()
      Me.RowSource = "SELECT * FROM cars WHERE make = """ & cboMake.Value & """ AND model = """ & cboModel.Value & """"
End Sub

This is air code, but something like this.
 

Users who are viewing this thread

Back
Top Bottom