IsNull Function

Returns a Boolean value indicating whether an expression contains no valid data (Null) or can be evaluated to 0.

Syntax

IsNull(expression)

The required expression argument is a numeric expression , string expression or object variable.

Remarks

IsNull returns True if expression is Null; otherwise, IsNull returns False.

Null is not the same as Empty, 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.

Example

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

Dim MyVar, MyCheck, MyStr As String

MyCheck = IsNull(MyStr)   ' Returns True.
Trace MyCheck

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

MyVar = Null
MyCheck = IsNull(MyVar) ' Returns True.
Trace MyCheck

 

See Also

IsDate Function , IsEmpty Function , IsNumeric Function , VarType Function