CitectVBA Programming Reference > CitectVBA Function Reference > Declarations > IsNull

IsNull

Determines if a Variant contains Null.

IsNull returns True if expression is Null; otherwise, IsNull returns False. If Exp consists of more than one variable, 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 as Empty, which indicates that a variable has not yet been initialised. It is also not the same as a zero-length string (" "), which is sometimes referred to as a null string.

Note: Use the IsNull function to determine whether VarName 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.

Syntax

IsNull(Exp)

Exp

A valid string, number or Variant containing a value recognizable as a string or number.

Return Value

Returns a Boolean True or False.

Related Functions

IsDate | IsEmpty | IsNumeric | VarType

Example

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

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

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