Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null IIF Statements

Status
Not open for further replies.
Jul 4, 2004
42
GB
Hello.

I have a Query attached to One Table. Three of the table columes are as follows.

ID - Autonumber datatype.
Date - DateTime datatype
Error - Yes/No datatype

The query is simple.

Error - Group By - Criteria <>0
Id - Count
Date - Where

Nowthe issue I require assistance with.

If the Error (yes/no)is positive the the CountofID will record the amount.
If the Error (yes/no) is not positive the query returns no results. (now very helpfull on a report)


I need an IIf statement to the effect that if [Errors] ="0" the [countofID] ="0" Rather than producing no result.

Thanks in advance for your help...
 
Select IIF([Error]=False, 0,1) As myError, NZ(Count(*),0)
FROM myTable
WHERE Date >#2006-06-20#
GROUP BY IIF([Error]=False, 0,1);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top