conditional combo box

  • Thread starter Thread starter McLean J
  • Start date Start date
M

McLean J

I have a "category" combo box that gets selected. A
second "product" box needs to display the following.
If the "category" field = 3 then show all products
But if the "category" field = anything else, match the
products combo box to those with the same field.

IE the products combo box has a field called category to
match against that is a numeric field as well.

When category 2 is selected, only products with category 2
show up (easy part).

How can I make ALL records show up when category 3 is
selected?
 
In the AfterUpdate event of the first box, create a SQL statement to assign to the
RowSource of the 2nd combo box.

Example:

Select Case Me.cboCategory
Case 3
Me.cboProduct.RowSource = "Select * From tblTable1;"
Case Else
Me.cboProduct.RowSource = "Select * From tblTable1 Where [Category]=" &
Me.cboCategory& ";"
End Select
 
Back
Top