Table of contents
Collapse the table of content
Expand the table of content

IsNull Function

office 365 dev account|Last Updated: 6/12/2017
1 Contributor

Returns a Boolean value that indicates whether anexpression contains no valid data (Null). SyntaxIsNull(expression) The required expressionargument is aVariant containing anumeric expression orstring expression. RemarksIsNull returns True if expression is Null; otherwise, IsNull returns False. If expression consists of more than onevariable, Null in any constituent variable causes True to be returned for the entire expression. The Null value indicates that the Variant contains no valid data. Null is not the same asEmpty, which indicates that a variable has not yet been initialized. It is also not the same as a zero-length string (""), which is sometimes referred to as a null string.

Important Use the IsNull function to determine whether an expression contains a Null value. Expressions that you might expect to evaluate to True under some circumstances, such as If Var = Null and If Var <> Null, are always False. This is because any expression containing a Null is itself Null and, therefore, False.


This example uses the IsNull function to determine if a variable contains a Null.

Dim MyVar, MyCheck
MyCheck = IsNull(MyVar)    ' Returns False.

MyVar = ""
MyCheck = IsNull(MyVar)    ' Returns False.

MyVar = Null
MyCheck = IsNull(MyVar)    ' Returns True.
© 2017 Microsoft