View Full Version : Cascaded Combo Box


tucker61
03-21-2008, 01:18 AM
I have a combo box called txtSearch which i want to filter out the contents so it only included records based on another 2 combo box called cboRowField and Weeksearch

I Managed to get the filter working just off 1 of my combo boxes Code works Below), but ideally need it to filter off them both.

"SELECT DISTINCT tblData.staffid FROM tblData WHERE (((tbldata.name)=Forms!frmdata!cboRowField)) ORDER BY tblData.staffid; "

I have tried

"SELECT DISTINCT tblData.staffid FROM tblData WHERE (((tbldata.name)=Forms!frmdata!cboRowField)) AND WHERE (((tbldata.Week)=Forms!frmdata!Week)) ORDER BY tblData.staffid;"

and also
SELECT DISTINCT tblData.staffid FROM tblData WHERE (((tbldata.name)=Forms!frmdata!cboRowField)) & WHERE (((tbldata.Week)=Forms!frmdata!Week)) ORDER BY tblData.staffid;

can anyone advise what i am doing wrong ?
thanks in advance

ajetrumpet
03-21-2008, 02:03 PM
First things first, don't use two WHERE clauses. The "clause" word is only used once, and the operators (such as AND and OR) are used more than once.

Did you see this (http://www.access-programmers.co.uk/forums/showthread.php?t=137236)??

It gives 3 different examples of how to cascade using 3 boxes.

tucker61
03-22-2008, 02:39 AM
thanks, I will try and simplify my code, as it has come from 2 different examples. I will then remove the 2nd where and try again.