MS Access IsNull() Function
The IsNull()
function in MS Access checks whether an expression evaluates to NULL
(meaning it doesn't have a value). It's a crucial function for handling missing data and preventing errors caused by NULL
values.
IsNull(): Definition and Usage
IsNull()
is frequently used in queries and VBA (Visual Basic for Applications) code to test for the absence of data. It returns a Boolean result: True
(-1) if the expression is NULL
, and False
(0) otherwise. This allows you to handle NULL
values appropriately in your applications.
Syntax
Syntax
IsNull(expression)
Parameter Values
Parameter | Description |
---|---|
expression |
The value or expression you want to check for NULL . This is required. |
Examples
Testing for a NULL Value
This example explicitly checks if NULL
is NULL
.
Syntax
SELECT IsNull(null);
Output
True (-1)
Testing a Non-NULL String
This checks if a string value is NULL
(it's not).
Syntax
SELECT IsNull("Hello");
Output
False (0)
Testing a Non-NULL Number
This example checks if the number 0 is NULL
(it's not).
Syntax
SELECT IsNull(0);
Output
False (0)