Return Both Yes/No Records In Query

kmwhitt

New member
Local time
Today, 10:18
Joined
Jul 18, 2004
Messages
8
I am trying to create a form based on a query that has a yes/no field.

If the user checks a box on the form it will return all the records regardless of whether they are "true" or "false". If the box goes unchecked only the "true" records get returned.

I have tried the following and many more variations within the criteria of the query with no success.

IIf([Forms]![SomeForm]![CheckBox]=False,True,IsNull)

The above will return no records when the checkbox is checked. Anyone got any suggestions?

Thanks,

Kevin
 
Kevin,

Add a new field to your query and set it's Criteria to True:

Code:
Expr1: [Forms]![YourForm]![YourTrueFalse] = True Or ([Forms]![YourForm]![YourTrueFalse] = False And [YourTrueFalseField] = True)

Wayne
 
???

I tried your suggestion and now it shows either all records or none. Please explain what this expression is meant to do. Does YourTrueFalse refer to the field on the form in all instances? I appreciate any help as I have a deadline of tomorrow....

Thanks again,

Kevin
 
Kevin,

The LAST one YourTrueFalseField refers to the field in the TABLE.

Essentially, if the one on the form is checked return True for the new field

Otherwise, return true if checkbox is false and the table's field is true.

You MUST set Criteria = True for the new field.

Wayne
 
???

I'm starting to understand. Should this new Expr1 field replace the Yes/No Field I had previously?

Thanks,

Kevin
 
I got it to work....

I'm not 100% sure how it works, but I am going to study it.... Thanks,

Kevin
 
Kevin,

In practice, you don't have to display the new query field. Like I said
last time, True if form is checked, otherwise only true if data is true.

Wayne
 

Users who are viewing this thread

Back
Top Bottom