Creating an AutoExec Macro
You can create a special macro that runs when you first open a database. The AutoExec macro can carry out actions such as opening a form for data entry, displaying a message box prompting the user to enter his or her name, or playing a sound greeting. The Northwind database opens with one of two forms depending on the current project security status.
All you need to do is create the macro with the actions that you want carried out at startup and save it with the name AutoExec. A database can have only one macro named AutoExec.
When you open a database, all the startup options that you set in the Current Database group of Access Options take place first. You can see these by clicking the Microsoft Office button and choosing Access Options. Then Access looks for a macro named AutoExec, if one exists, and executes the actions in it.
You can bypass both the startup options and the AutoExec macro by pressing shift when you open the database.
CAUTION: Many of the same options can be set in the AutoExec macro as in the Startup dialog box. Be careful not to include conflicting settings in the macro.
In this tutorial:
- Automating with Macros
- Standalone vs. Embedded Macros
- Creating a Macro
- Choosing Actions
- Testing and Debugging a Macro
- Adding Conditions to a Macro
- Assigning a Macro to an Event Property
- Some Common Uses for Macros
- Filtering Records
- Changing the Flow of Operations
- Create a Macro Group
- Documenting Macros
- Creating an AutoExec Macro