Query Filtering with a Check Box

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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)
 
Back
Top