Set the Value of a Control by Using a Macro — Example
The following macro opens the Add Products form from a button on the Suppliers form. It shows the use of the Echo, Close, OpenForm, SetValue, and GoToControl actions. The SetValue action sets the Supplier ID control on the Products form to the current supplier on the Suppliers form. Then the GoToControl action moves the focus to the Category ID field, where you can begin to enter data for the new product.
Click the action name to see the arguments for each action.
Action | Comment |
---|---|
Attached to the Add Products button on the Suppliers form. | |
Echo | Stop screen updating while the macro is running (echo is turned off). |
Close | Close Product List form |
OpenForm | Open the Products form. |
SetValue | Set the Supplier ID control to the current supplier on the Suppliers form. |
GoToControl | Go to the Category ID control. |