ISNULL Question

J

Jasper Recto

Is it possible to have an equation in the IS NULL funtion? For example, can
you do this:

IF IS NULL (X - Y) Then ... Else...

Thanks
Jasper
 
B

Brendan Reynolds

I'm not quite sure if we're talking about IsNull() (VBA) or IS NULL (SQL),
but the answer is yes, it can be done, with either ...

? isnull(null - 1)
True

SELECT [Order Details].UnitPrice, [Order Details].Quantity,
IIf([unitprice]*[quantity] Is Null,"Null","Not Null") AS Expr1
FROM [Order Details];

Keep in mind that in general expressions will evaluate as Null if any part
of the expression evaluates as Null, so "If IsNull(x - y) Then" is really
just the same thing as "If IsNull(x) Or IsNull(y) Then".

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Top