Sub?

S

Skyarina

I will like to create three combo boxes (already done) in which each narrows
down the previous information inputted. ie. Categories: Cameras; Sub
Categories: Digital; Detail: Fuji, etc. But if I change the Category to be
other (ie Clothing) the sub category and detail boxes will give only data
corresponding to the category selected?
 
G

Graham Mandeno

Hi Skyarina

You should filter the rowsource of each combo box according to its parent in
the hierarchy.

For example, say your rowsource for cboSubcategory is:
Select SubCatID, SubCatName from SubCategories order by SubCatName;

You need to add a WHERE clause:
Select SubCatID, SubCatName from SubCategories
where CatID=Forms!YourForm!cboCategory
order by SubCatName;

Also, you need to requery the "child" combo boxes in the AfterUpdate event
of the parent ones:

Private Sub cboCategory_AfterUpdate()
cboSubCategory.Requery
cboSubCategory = Null
cboDetail.Requery
End Sub
 
Top