- To create a macro, click Macros under Objects, and then click the New button on the Database window toolbar.
- In a blank action row, click Save in the action list, and then set the Object Type argument to the type of the object you want to save and the Object Name argument to the name of the object.
- Click Save to save the macro.
- To test, select the macro and click Run on the toolbar.
- The macro is now ready for use by setting the property of another object.
For example, to save a form by clicking a command button on the form, set the button's OnClick property to the name of the macro.
Save a database object by using an event procedure
- To open the event procedure for the appropriate event, open the form in Design view.
- Display the property sheet for the control you will use to trigger the event and then click the Event tab.
- Click the property for the event that you want to trigger the procedure.
For example, to respond to a mouse click on a command button, open the button's OnClick event procedure.
- Click Build next to the property box to display the Choose Builder dialog box.
- Double-click Code Builder to display the event procedure window.
- Use the Save method to carry out the Save action in the procedure, setting the objecttype argument to the type of the object you want to save and the objectname argument to the name of the object.
- To test, run the procedure by opening the form in Form view and performing the event that triggers the Save action.
For example, if the procedure is located in the OnClick event procedure for a command button, click the command button to save the object.