G
Guest
Hello all -- I'm have 2 tables -- one with products and one with categories.
They are joined on a "categoryID" key. In the category table, there are 4
'levels' of categories, as a heirarchy -- ex:
ID LVL1 LVL2 LVL3 LVL4
001 Books Fiction Mystery Medical
I have a form that allows a user to choose values for each level via 4
separate comboboxes, and then passes the values for each combobox into a
query which then returns appropriate results. However, the query only works
when a user chooses values for ALL 4 levels. It returns no results if a user
only chooses values for one, two, or three levels (ie: "Show me all products
that have a Level 1 category of "Books").
My basic query says: return all products where the Level 1 category =
combobox1 AND Level 2 category = combobox 2 AND Level 3 category = combobox3
AND Level 4 Category = combobox4.
I thought that the problem may have stemmed from NULL values being passed
thru in the query criteria if someone didn't choose a Level on the form. So,
I adjusted the query criteria to read IFF(combobox2 IS NULL, "*", combobox2).
However, this still doesn't work if a user neglects to choose a value for
combobox 2.
Any ideas or suggestions?
Thanks greatly in advance!
They are joined on a "categoryID" key. In the category table, there are 4
'levels' of categories, as a heirarchy -- ex:
ID LVL1 LVL2 LVL3 LVL4
001 Books Fiction Mystery Medical
I have a form that allows a user to choose values for each level via 4
separate comboboxes, and then passes the values for each combobox into a
query which then returns appropriate results. However, the query only works
when a user chooses values for ALL 4 levels. It returns no results if a user
only chooses values for one, two, or three levels (ie: "Show me all products
that have a Level 1 category of "Books").
My basic query says: return all products where the Level 1 category =
combobox1 AND Level 2 category = combobox 2 AND Level 3 category = combobox3
AND Level 4 Category = combobox4.
I thought that the problem may have stemmed from NULL values being passed
thru in the query criteria if someone didn't choose a Level on the form. So,
I adjusted the query criteria to read IFF(combobox2 IS NULL, "*", combobox2).
However, this still doesn't work if a user neglects to choose a value for
combobox 2.
Any ideas or suggestions?
Thanks greatly in advance!