Need Help With Confusion In WHERE Statement

J

Jason

I am building a web application that uses an access database. I am using multiple select boxes to allow the user to select multiple salesmen, customers, etc. and I am generating the SQL statement on the next page. In addition to this, the user is required to put a date range. Therefore, my SQL WHERE statement looks something like this

WHERE (saleDate > txtFromDate AND salesDate < txtToDate) AND (SalesmenID = selSalesmenID(0) OR SalesmenID = selSalesmenID(1)) AND (CustomerID = selCustomerID(0) OR selCustomerID(1))

I want the user to be able to select multiple customers and salesmen and them any combination of those selections to show up in the result set. The problem is that only the records with the selSalesmenID(0) and selCustomerID(0) are showing up.

How do I get all customer and salesmen combinations to show up?

Thank you,
Jason
 
Top