Query criteria for a check box

tMitch

Registered User.
Local time
Today, 09:11
Joined
Sep 24, 2002
Messages
43
I am using a combo box in a form to set the criteria for a check box in my query. I want the user to be able to choose whether they want only the checked boxes to show, only the unchecked boxes, or all of the boxes.

I have set the combo column 1 as -1(for true) and 0 (for false), which works, but I don't know how to set it to get both true and false. I suspect that I need some code (as Event Procedure?), but can't find any info on this.

Can someone help with this?

Thank you.
 
I would do this differently, this I believe to be more intuitive:

Have a check box that when checked - the combo is not enabled, therefore all checkboxes values are considered in your query.
When the same check box is unchecked - the combo is enabled allowing the user to specify which of the other conditions you want to query the tables for.

You could also do this with one control only! Try using solely a checkbox control and set its Tri State property to True.
Now, you can cover all three options : i.e. True (-1), false (0) and NULL (both types)!

Does this help - assuming of course I have understood your reqs.?

GJT
 
This question has actually been answered here many times but I'm not sure what you'd have to search on to find the answer.

The query's criteria needs to be:

Where SomeField = Forms!YourForm!YourField OR Forms!YourForm!YourField = 2;

Use 2 as the third value (both true and false) for the above example to work and don't forget to modify the field and form names.
 
Hi -

Thanks for your replies. I'm still working on this. It's probably simple, but I don't know code and I'm fairly new to Access.

I have the checkbox so that when it's checked, the combo is not enabled, and when it’s not checked the combo is enabled. Triple State is set to True.

However, when the checkbox is checked the query runs only the checked boxes instead of both true and false (Null), and when the checkbox is not checked it runs only unchecked boxes regardless of what I choose in the combo box. The greyed-out checkbox gives me an error.

I tried using the Where Somefield in the criteria of my query and set the Default value to 2. This works when the form is first opened (and the checkbox is checked) – then I get both true and false checkboxes. After that, I get errors even if I go back and check the box. Without a default value I get error messages.

What am I doing wrong? How do I "use 2 as the third value"?

:confused:
 

Users who are viewing this thread

Back
Top Bottom