A macro is a series of commands that an application program executes. Macros help automate tasks within a program such as Microsoft Access. They allow you to program your database without needing to learn complex programming languages.
Follow these steps to create a macro in Microsoft Access:
- Click the Create tab in the Ribbon and select 'Macro'.
- Use the dropdown menu to select your first action – choose 'OpenForm'.
- In the bottom pane, select the form you wish to open (e.g., 'Customers Form').
- Use the dropdown menu to select your second action – choose 'GoToRecord'. In the Record field, select 'New' to ensure the form opens a blank record.
- Click the Save icon and enter a name for your macro. Name it 'AutoExec' to make it run automatically when the database opens.
To run your macro, use one of the following methods:
- From the Navigation Pane, double-click the macro name.
- On the Database Tools tab, in the Macro group, select 'Run Macro', choose your macro from the list, and click OK.
- Open the macro in Design view, and on the Design Tab in the Tools group, select 'Run'.
- You can also open macros in Design view by right-clicking in the Navigation Pane and selecting 'Design View'.