Using Yes/No fields in a query

  • Thread starter Thread starter Don
  • Start date Start date
D

Don

I have a Yes/No field in my query called Chronology Doc.

I have an option Group on my form. If a user Selects No
(option 1) I want ONLY the "Yes" records to print. If the
user selects Yes, I want all the records to print.

The problem seems to be with the FALSE portion of my if
statement. Isimply want to say, is the user selects
option 1, print only the yes records, but otherwise print
all the records. No matter what I choose, only Yes
records are extracted.

I've tried 'Like *' Putting No or Yes in the false
portion of the if statement results in the following:

IIf([Forms]![frmReports]![Frame28]=1,Yes,([tblabc].
[ChronologyDoc])=No Or ([tblabc].[ChronologyDoc])=Yes)

Any ideas would be apprecited. Thanks in advance.

Don
 
So, picking false restricts the records, and picking true shows all data.

Try something like this:

Select * from table
WHERE iif([Forms]![frmReports]![Frame28], [Somefield]=True, 1=1)

The gist being that if Frame28 is True(which is a non-zero value), then
apply the criteria, otherwise use the 1=1 criteria, which should produce all
records.
 
Back
Top