January 22nd, 2014, 11:50 AM
MS Access Yes/No Query
Hello everyone! I am back with yet another question!
I am building a database for customers of a clothing retail outlet. Regarding this situation, I have two tables. The primary table, which is 'CustomerDemographics", and the secondary 'Product' table.
The 'CustomerDemographics' column that is necessary for the 'ProductQuery' is the 'Female' column, which is a Yes/No Checkbox. This corresponds with the 'Female' column on the 'Product' table, which is also a column of Yes/No checkboxes
What I am trying to do is, if 'Female' is selected on the 'CustomerDemographics', then have it show only products that have 'Female' checked off on the "Product" table. If 'Female' is not checked on the 'CustomerDemographics', then the query needs to show all of the products.
This is what I've tried:
I've also tried the same criteria replacing "Yes" with "True" and "No" with "False, as well as "Yes" with "0" and "No" with "-1".
I know this sort of IIf statement works in this same exact manner using text fields, as I've done it before, but I can't get it to work with Yes/No checkboxes.
The error I get is: Data type mismatch in criteria expression
Additionally, when playing around trying to figure it out, I removed the Criteria, and tried multiple, simple criteria, including "True", "Yes", "No", False", "0", "-1", with and without the quotation marks. It does not affect the results whatsoever and I don't get any results. It is as though it is not recognizing the Yes/No checkbox as any sort of actual data.
I've created a new 'Female' column, copied the data over and deleted the old column, and it didn't make a difference.
Anyone know what I'm doing wrong?