How do i do criteria on a drop down box

G

Guest

ive made a drop box with all car makes and now i want to make a model drop
box so when you select you make (Ford for example) when youwent to choose the
model it would have all fords models.
 
T

Tom Ellison

Dear Grant:

That sounds right to me.

This is sometimes called "drill down" or "cascading combo boxes".

There are two ways I can suggest to do this.

1. On the click event of the Makes combo box, write the SQL for the Models
combo box so it filters for the selected model.

2. Have the query for the Models reference the Makes combo box so it
filters similarly.

This presumes a proper data structure, which you did not discuss.

A problem arises if a make and model have already been selected, and the
make is subsequently changed. This would almost certainly give you a
make/model combination that is invalid. The click event of the Make combo
box should set the value of the Model combo box to null.

In some circumstances, other than make/model, it is possible the lower level
combo (your model) could have the same values for multiple cases of the
value in the primary level combo box. This would be like having Pinto for
both Ford and Chevy. Probably won't happen for automobiles, but does happen
in many other cases. In this case, I usually check whether the lower level
combo value is valid for the new primary level combo's value, and null it
only if it doesn't exist.

That is, I hope, a modest primmer on how this can be done.

Tom Ellison
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Drop box 4
Access Remove rows based on multiple fields 2
dropp box 1
creating forms 3
Criteria for a lookup 5
How can I create a form with a cascaded lookup? 10
Access 2000 Form design/combo box dilemma 3
drilling down 4

Top