Validate data by using a macro
- Create a macro.
How?
- In the Macro window, make sure Conditions on the toolbar is pressed in.
- In the Condition column of a blank action row, enter a validation condition.
- In the Action column, click the action in the action list that you want to carry out if the validation condition is true.
- For any additional actions you want to carry out if the validation condition is true, enter an ellipsis (...) in the Condition column followed by the action in the Action column. For example, it's usually a good idea to carry out a CancelEvent action for each validation condition after any other actions have been carried out.
- Click Save to save the macro.
- Open the form in Design view.
- For the event that you want to trigger the validation, set the event property to the name of the macro. For example, to trigger the validation when a control is updated with changed data, set the BeforeUpdate event property of the control to the name of the macro.
Tip To validate data before a record as a whole is updated, attach the validation macro to the form's BeforeUpdate event rather than to the control's BeforeUpdate event.
For an example of validating data by using a macro, click .
For information about the events used for data validation, click .
For information about the order of validation for controls and fields, click .