Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

If you want to perform a particular set of actions every time that an Access database starts, you can create an AutoExec macro. For example, you might want to automatically maximize the application window, lock the Navigation Pane, and then open a particular report.

An AutoExec macro is just a macro that is named AutoExec. When a database starts, Access runs the AutoExec macro before it runs any other macros or VBA code.

Create an AutoExec macro

If you have already created a macro that contains the actions that you want to occur when the database starts, just rename the macro to AutoExec, and it will run the next time that you open the database. Otherwise, follow these steps to create a macro:

  1. On the Create tab, in the Other group, click Macro.

  2. In the drop-down list at the top of the Macro Builder, select the action that you want to perform. If applicable, type the appropriate values in the argument boxes.

    • If you cannot find the action you want, on the Design tab, in the Show/Hide group, make sure Show All Actions is selected. This expands the list of actions that you can use, but the list will include some actions that will only run if the database is granted trusted status. For more information, see the article Decide whether to trust a database.

  3. Repeat step 2 for each additional action you want to occur.

  4. Click Save, and in the Save As dialog box, type AutoExec.

  5. Click OK and then close the Macro Builder. The new macro will run the next time that you open the database.

For more information about how to create macros, see the article Create a user interface (UI) macro.

NOTES:

Top of Page

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×