To run a macro when the Enter or Exit event occurs, set the OnEnter or OnExit property to the name of the macro.
Remarks
When the Enter or Exit event occurs, you can run a macro that uses a GoToControl action to change the tab order based on current data in a control. For example, if the user enters Single in the MaritalStatus field, you can ensure that the focus doesn't move to the SpouseName field.
You can use the CancelEvent action in an Exit macro to cancel exiting the control. You can't use the CancelEvent action in an Enter macro to cancel the Enter event. However, you can use the GoToControl action in an Enter macro to move the focus to a different control.