# The opposite of <> (Not null)

Whats the opposite of using <>

I want to count the number of rows that are blank ?
###### Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Computer Integration SpecialistCommented:
=

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
I haver this line currently:

=Sum(IIf([date]= <>,1,0))

I've tried replacing it with both:

=Sum(IIf([date]= ,1,0))

=Sum(IIf([date]= =,1,0))

Does'nt work?  Am I taking your instruction too literally ?
Computer Integration SpecialistCommented:
http://support.microsoft.com/?kbid=209505

=Sum(IIF([YesNoField],1,0))        Yes
=Sum(IIF([YesNoField],0,1))        No
=Sum(IIF(Not[YesNoField],1,0))     No
=Sum(IIF(IsNull[YesNoField],1,0))  Null

the above is a good reference
Commented:
Yes, the syntax used depends on the contex:
For null values these syntaxes have been used in different situations:
= Null, Is Null; IsNull; nz

For not null:
<> Null;Not IsNull; Is Not Null
Commented:
if you are checking a date field you can use  Isdate([DateField]) to count the non empty field

SELECT Sum(IIf(IsDate([OrderDate]),1,0)) AS Expr1
FROM tblOrders;
---

=Sum(IIf(IsDate([OrderDate]),1,0))
Commented:
also remember that "blank" can be NOt Null. An empty string "" is Not Null

YOu can test for empty with Not IsEmpty or <> ""

you can build a statement like

if myField Not isNull and Not isEmpty

but a better way is to simply evaluate the length of the field. if it is zero..it can be null or empty

If len(myField) = 0 then
ConsultantCommented:
Andy,

says  is:    Sum,  if field Date is equal and not equal then use numeric 1  else use 0.

It will always be 0 because the compare cannot be both equal and not equal.

Capricorns        =Sum(IIf(IsDate([OrderDate]),1,0))
says   Sum,  if field Date is a real date then use numeric 1  else use 0.

If you are comparing the field, in a query to a table/field called date then

sum (IIf ([TableField] = [date] ,1,0))
says  sum, if the table field is equal to the field date then use numeric 1  else use 0.

Don
Commented:
Try this:

=Sum(IIF(nz([date],0)=0,1,0)
Commented:
Oops parenetheses:

=Sum(IIF(nz([date],0)=0,1,0))
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.