Synchronize Forms by Using a Macro — Example

The following macro opens a Product List form in the lower-right corner of the Suppliers form, displaying the current supplier's products. It shows the use of the Echo, MsgBox, GoToControl, StopMacro, OpenForm, and MoveSize actions. It also shows the use of a conditional expression with the MsgBox, GoToControl, and StopMacro actions.

Click the action name to see the arguments for each action.

Condition Action Comment
    Attached to the Review Products button on the Suppliers form.
  Echo Stop screen updating while the macro is running (echo is turned off).
IsNull([Supplier ID]) MsgBox If there is no current supplier on the Suppliers form, display a message...
  GoToControl Move focus to the CompanyName control.
... StopMacro ... and stop the macro.
  OpenForm Open the Product List form and show the current supplier's products.
  MoveSize Position the Product List form in the lower right of the Suppliers form.