G
Guest
I realize synchornized combo boxes has been an over-discussed topic in this
group. But I don't see any thread that reflects my need here and would really
appreciate if I can just get the extra 3rd combo box to work.
I now have 2 synchronized combo boxes (cboCategory and cboType) in a form
and now need a 3rd one (cboSize), but don't know how this could be done.
The RowSource of cboCategory is SELECT DISTINCTROW [CategoryID], [Category]
FROM tblCategory ORDER BY [Category]. -- tblCategory is a table with a list
of all categories.
The RowSource of cboType is from a query named qryAllProducts --
qryAllProduct is like a master datasheet and has records of all products
(incl. fields of Category, Type and Size).
Currently in this 2-combo-box set, Type is restricted by the selection of
Category. But I was hoping to expand this filter system by adding a 3rd combo
box, so that Size is restricted again by Type.
e.g. Now if I select "pants" in cboCategory, only things like "jeans,
trousers, etc" appear in cboType. How could I add a cboSize, so that if I
select "jeans" then only available jeans sizes (recorded in Size field of
qryAllProducts) are displayed in cboSize?
' --- start of Form module code ---
Private Sub cboCategory_AfterUpdate()
Me.cboType.RowSource = "SELECT Type FROM" & _
" tblType WHERE CategoryID = " & Me.cboCategory & _
" ORDER BY Type"
Me.cboType = Me.cboType.ItemData(0)
End Sub
Private Sub cboType_AfterUpdate()
' Filter records under selected category and type
DoCmd.ApplyFilter , "Type = '" & cboType & "'"
End Sub
' --- end of module code ---
group. But I don't see any thread that reflects my need here and would really
appreciate if I can just get the extra 3rd combo box to work.
I now have 2 synchronized combo boxes (cboCategory and cboType) in a form
and now need a 3rd one (cboSize), but don't know how this could be done.
The RowSource of cboCategory is SELECT DISTINCTROW [CategoryID], [Category]
FROM tblCategory ORDER BY [Category]. -- tblCategory is a table with a list
of all categories.
The RowSource of cboType is from a query named qryAllProducts --
qryAllProduct is like a master datasheet and has records of all products
(incl. fields of Category, Type and Size).
Currently in this 2-combo-box set, Type is restricted by the selection of
Category. But I was hoping to expand this filter system by adding a 3rd combo
box, so that Size is restricted again by Type.
e.g. Now if I select "pants" in cboCategory, only things like "jeans,
trousers, etc" appear in cboType. How could I add a cboSize, so that if I
select "jeans" then only available jeans sizes (recorded in Size field of
qryAllProducts) are displayed in cboSize?
' --- start of Form module code ---
Private Sub cboCategory_AfterUpdate()
Me.cboType.RowSource = "SELECT Type FROM" & _
" tblType WHERE CategoryID = " & Me.cboCategory & _
" ORDER BY Type"
Me.cboType = Me.cboType.ItemData(0)
End Sub
Private Sub cboType_AfterUpdate()
' Filter records under selected category and type
DoCmd.ApplyFilter , "Type = '" & cboType & "'"
End Sub
' --- end of module code ---