Access: IsNull Function

In Access, the IsNull function returns a boolean value that indicates whether or not an expression contains no valid data (Null).

The syntax for the IsNull function is:

IsNull ( expression )

In Access, the expression argument can be any numeric or string expression. The IsNull function returns True (-1) if the expression contains the Null value; otherwise, it returns False (0). Null is not the same as a zero-length string, which is often referred to as a null string.

Important: Using the IsNull function is the only way from within Access to determine whether or not an expression contains a null value.

Example

IsNull(null)                returns TRUE
IsNull("WebCheatSheet")     returns FALSE
IsNull(2006)                returns FALSE

VBA Code

Dim MyResult as Boolean 
MyResult = IsNull("WebCheatSheet")

This example uses the IsNull function to determine if a variable contains a Null. Now the MyResult variable would contain FALSE as a value.

SQL query

You can also use the IsNull function in a query.

SELECT IsNull([Address]) AS Expr1
FROM AntiqueOwners

admin

admin

Leave a Reply

Your email address will not be published.