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. This macro should be attached to the Add Products button on the Suppliers form.
Action | Arguments: Setting | Comment |
---|---|---|
Echo | Echo On: No | Stop screen updating while the macro is running. |
Close | Object Type: Form
Object Name: Product List Save: No |
Close Product List form. |
OpenForm | Form Name: Products
View: Form Data Mode: Add Window Mode: Normal |
Open the Products form. |
SetValue | Item: [Forms]![Products]![SupplierID]
Expression: SupplierID |
Set the Supplier ID control to the current supplier on the Suppliers form. |
GoToControl | Control Name: CategoryID | Go to the Category ID control. |