In some cases, you may want to carry out an action or series of actions in a macro only if a particular condition is true. For example, if you're using a macro to validate data in a form, you might want to display one message in response to one set of values entered in a record and another message in response to a different set of values. In cases like these, you can use conditions to control the flow of the macro.
For example, the following macro carries out the StopMacro action when there is no value in the Country field (when the value is Null). It carries out one of several pairs of MsgBox and CancelEvent actions if the length or form of the PostalCode value isn't appropriate for the country in the Country field.
A condition is a logical expression. The macro follows different paths depending on whether the condition is true or false. To see examples of macro conditions, click .
You enter conditions in the Condition column in the Macro window. If a condition is true, Microsoft Access carries out the action in that row. You can have Microsoft Access carry out a series of actions if the condition is true by typing an ellipsis (...) in the Condition column of the actions that immediately follow the condition.
For information on how to make a macro run under specific conditions, click .