Creating an 'AutoExec' Macro

In versions of Access prior to Access 2003, the only way to have something happen when the user opens a database is to use an AutoExec macro. With Access 2003, you can use either an AutoExec macro or Startup options to determine what occurs when the user opens a database. Using an AutoExec macro to launch the processing of an application is certainly still a viable option.

Creating an AutoExec macro is quite simple; AutoExec is just a normal macro saved with the name AutoExec. An AutoExec macro usually performs tasks such as hiding or minimizing the Database window and opening a Startup form or switchboard. The macro shown in Figure 13.22 hides the Database window, displays a welcome message, and opens the frmClients form.

Figure 13.22. An example of an AutoExec macro.



When you're opening a database to make changes or additions to the application, you probably won't want the AutoExec macro to execute. To prevent it from executing, you hold down the Shift key as you open the database.

    Part III: Creating Your Own Database and Objects
    Part V: Advanced Topics