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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count a Null value in query

Status
Not open for further replies.

Rick4077

Technical User
Oct 19, 2004
149
US
If this line of a query comes across a null in the field S.SellName I still need the query to count that null value.

Code:
,Sum(IIf(S.ListName Like C.OfcName&"*" And S.SellName Not Like C.OfcName&"*",1,0)) AS TSO

Can I use something like this in the WHERE clause?

If IsNull S.ListName OR S.SellName Then Null=""

I'm guessing here.

Thanks . . . Rick
 
Have a look at the Nz function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That's exactly what I was doing!

Here is how I fixed it.

Code:
,Sum(IIf(S.ListName Like C.OfcName&"*" And NZ(S.SellName) Not Like C.OfcName&"*",1,0)) AS TSO
,Sum(IIf(S.ListName Like C.OfcName&"*" And NZ(S.SellName) Not Like C.OfcName&"*",S.SalePrice,0)) AS TSODV

Thanks Much!

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top