Access Check If Field is Null, Conditional Macro
This article explains how you can create a conditional macro that will check if the value in a field is Null or not. If the value is null, it will set the field with a default value.
Consider the database below:
We want to create a macro that will check the value of the field [First Name]. If the field is empty, it will fill it with the value “N/A”.
Conditional Expression: In this field you can create a conditional expression. If it returns true the action specified in the next field will be executed. For this example we will use the conditional expression below:
It checks if the value in the first field is null or not:
Add New Action: This field determines the action that will take place if the conditional expression in the previous field returns true. From the drop down list select “SetField”:
Name: The name of the field to modify. In this example we want to modify the [First Name] field when it is null, therefore input the value below in this field:
You can download the sample file used in this article from the link below:
- Access, Add Leading Zeros Custom Number Formats
- Access, Convert User Input to Uppercase
- Access, Convert User Input to Lowercase
- Access Field Properties Locked
- Access, Fixed Decimal Places Number Format
- First Letter Uppercase Only Access Tables
- First Letter Uppercase Only Access Form