To create a macro in Microsoft Access 2013 or 2016:
- Click Macro from the CREATE tab
- Add actions by selecting an action from the combo box
- Customise the actions if required
- Repeat steps 2 and 3 for each action you want to add
- Save the macro
The following screenshots show an example of the above steps.
The Macro Button
Click Macro from the CREATE tab.
The Combo Box
Select an action from the combo box.
Customise the Action
Customise the actions if required.
Repeat if Required
Repeat steps 2 and 3 for each action you want to add.
Repeating step 2 (selecting another action from the combo box) adds the action here, where again, you can configure as required.
Save the macro
Testing your Macro
You should always test your macro to make sure it does what you expect it to do.
Using the above example, you could close the database then open it again to make sure that the macro runs when the database is opened.
You should check that the database does in fact, open the form (as specified in the first action) and open a new record (as specified in the second action).
Macros can be as complex as you like, so try to think about all scenarios that need to be tested.
Creating a Button to Run a Macro
The above macro runs every time the database is opened but you probably won’t want all your macros running every time the database is opened.
You can create a button to run a macro instead. Here’s how to add a macro button to a form. The user can run the macro by clicking the button.