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

Cascading Combo-boxes?

Status
Not open for further replies.

BennyWong

Technical User
May 19, 2002
86
0
0
US
Hello All,
I am using Access 2002. I am in the beginning of a project and wanted to know how I can create what I called a "Cascading Combo-boxes". An example to this is of the following:

1. Product
2. Category
3. Type
4. Model

The above is a list of Combo-boxes. What I mean is a user
will select something in the Product combobox which inturn allows the user to select something from the Category combo-box which inturn allows the user to select from the Type combobox and finally select from the Model combo-box.
How can I do this? Thanks in advance for your advice and help.

 
I've never done such a thing, but here's my approach if I were to look into it; Basically just modify the rowsource property of the combo boxes from within after_update events of the combo boxes. You should be able to set it equal to any sql statement, then requery the combo box so it gets updated. (someone correct me if I'm mistaken).
 
Set your source for combobox1; create a macro to run AfterUpdate such that the macro has two steps:

SetValue for combobox2 to Null
Requery combobox2

Set combobox2 so that its ControlSource is a query that selects distinctrow from a table with fields for the two boxes, such that the already-selected choice for box1 equals the field in the table. OnChange it does a lookup in a table which has the fields for the two boxes, such that the value of combobox2 chosen is equal to the value in the table.

Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top