Query Filtering with a Check Box

G

Guest

Hello,

I am currently creating my first large scale database and have run into the
beginnings of several problems.

On a form I have a check box so that when checked it will bring up all the
records that have a date filled in the [Actual Complete Date] field of the
table. I'm using a query and an iif statement however when the box is
unchecked no records are returned. How do I go about fixing the criteria in
the query so that I get not only the completed records but all the records
when the box is unchecked. I have a sample piece below.

IIf([MMCNfrm]![CompletedCheck] = -1, ([CNT].[Actual Complete Date]),
([CNT].[Actual Complete Date]) And ([CNT].[Actual Complete Date] Is Null))

Thanks very much
 
A

Allen Browne

It will probably easier and more efficient to build the SQL statement that
only contains the criteria you wish to use.

You can kinda fudge it by causing the IIf() to return a True/False value to
the WHERE clause with something like this:
WHERE IIf([Forms]![MMCNfrm]![CompletedCheck] = True, [Actual Complete Date]
= True, True)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top