Verify variable is not null

G

Guest

I am using Access 2000. How can I varify that a variable is not null with an
IF statement? Seems like the following code would work but ISNOTNULL isn't
the opposite of ISNULL. What is?

If ISNOTNULL(Variable1) then
'Do my thing
Endif
 
G

Guest

Hi, Del,

Try it this way:

If Not Isnull(Variable1) then
'Do Your thing
End If

You were close but not quite :>)

--
HTH

Mr B
email if needed to:
draccess at askdoctoraccess dot com
 
F

fredg

I am using Access 2000. How can I varify that a variable is not null with an
IF statement? Seems like the following code would work but ISNOTNULL isn't
the opposite of ISNULL. What is?

If ISNOTNULL(Variable1) then
'Do my thing
Endif

There is no such Access thing as ISNOTNULL (1 word).

There is IS NOT NULL (3 words in SQL) as well as NOT ISNULL (2 words
in Access and VBA).

So you could use.. to check for Null as well as a zero length string:

If Not IsNull(Variable1) or Variable1 = "" Then ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top