Run MS Access Macro on Open

Victoria Jul 07, 2026

Opening a Microsoft Access database and having a macro run automatically can streamline your workflow, especially when you perform the same tasks repeatedly. This feature, known as AutoExec, is a powerful tool that can save you time and reduce errors. Let's delve into how to make this happen.

Macro To Open Query in MS Access 2007
Macro To Open Query in MS Access 2007

Before we proceed, ensure that your macro is correctly created and saved within your database. If you're unsure about creating macros, we've got a comprehensive guide on that too. Now, let's focus on making your macro run on open.

Microsoft Access Issues List Tracking Templates Database  for Microsoft Access 2016 Software - Verified: July 2026 ✅
Microsoft Access Issues List Tracking Templates Database for Microsoft Access 2016 Software - Verified: July 2026 ✅

Enabling the Macro to Run on Open

Microsoft Access provides a simple way to run a macro when a database is opened. This is achieved through the 'AutoExec' macro.

MS Access DLOOKUP Function - Microsoft Access Programs
MS Access DLOOKUP Function - Microsoft Access Programs

Here's how you can set it up:

Using the Macro Builder

MS Access Tutorial
MS Access Tutorial

The Macro Builder is a user-friendly tool that allows you to create and edit macros without writing any VBA code.

To use it, follow these steps:

  1. Open your database in Microsoft Access.
  2. Press Alt + F11 to open the Visual Basic for Applications (VBA) window.
  3. In the VBA window, click Insert and then Module.
  4. In the new module, type AutoExec in the first line and press Enter.
  5. Press F5 to run the macro. A message box will appear, asking if you want to add a macro to the AutoExec macro group. Click Yes.
  6. In the Macro Builder, add your desired actions and then click OK.
Tutorial - Creating a Contact Management Database (CRM) using Microsoft Access
Tutorial - Creating a Contact Management Database (CRM) using Microsoft Access

Using VBA Code

If you're comfortable with VBA, you can also use code to set up the AutoExec macro.

Here's a simple example:

MS Access - Create Form
MS Access - Create Form

<?AutoExec MacroName="YourMacroName">

Replace "YourMacroName" with the name of your macro. Save the module, and your macro will run automatically whenever you open the database.

Troubleshooting Common Issues

How to Use Macros in Microsoft Access 2013 - Examples of Macros and Using Autoexec
How to Use Macros in Microsoft Access 2013 - Examples of Macros and Using Autoexec
MS Access - Stored Procedure as Recordset for Forms
MS Access - Stored Procedure as Recordset for Forms
MS Access - A Cost Effective, Powerful Business Tool
MS Access - A Cost Effective, Powerful Business Tool
How to Create or Solve MS Access Enter Parameter Value
How to Create or Solve MS Access Enter Parameter Value
MS Access Do-While Statement - Microsoft Access Programs
MS Access Do-While Statement - Microsoft Access Programs
How to Automate Tasks in MS Access with Macros
How to Automate Tasks in MS Access with Macros
a screenshot of an excel spreadsheet with the access - templates button highlighted
a screenshot of an excel spreadsheet with the access - templates button highlighted
the logo for ms access's database recovery program, with an image of a stack
the logo for ms access's database recovery program, with an image of a stack
How to open MS access Database in SPSS using Syntax file command
How to open MS access Database in SPSS using Syntax file command
MS Access 2013 to show only startup form and nothing else
MS Access 2013 to show only startup form and nothing else
MS Access
MS Access
Tutorial: How to create an Advanced Form in MS ACCESS
Tutorial: How to create an Advanced Form in MS ACCESS
No More Negative Numbers! Fix MS Access Database Validation Rule
No More Negative Numbers! Fix MS Access Database Validation Rule
EJERCICIO MACROS
EJERCICIO MACROS
Audit Trail using Data Macros
Audit Trail using Data Macros
How To Create User Permissions and Customized Menus in MS Access -  		 		Post.Byes
How To Create User Permissions and Customized Menus in MS Access - Post.Byes
How to Create an Append Query in MS Access
How to Create an Append Query in MS Access
HR Employee Staff training database. Track your workforce training taken, expiry dates | MS Access database template
HR Employee Staff training database. Track your workforce training taken, expiry dates | MS Access database template
How to Sum value of fields in a ms access form -VBA
How to Sum value of fields in a ms access form -VBA
MS Access Incident Tracker Database | Accident and Incident Management register | Template
MS Access Incident Tracker Database | Accident and Incident Management register | Template

While the AutoExec macro is a powerful tool, you might encounter some issues. Here are a couple of common problems and their solutions:

Macro Not Running on Open

If your macro isn't running when you open your database, check the following:

  • Ensure that your macro is saved and the name is spelled correctly in the AutoExec macro.
  • Check if there are any errors in your macro. You can do this by pressing Ctrl + G in the VBA window to open the Immediate window and then typing ?Debug.Print Err.Description.

Macro Running Too Slowly

If your macro is running slowly, consider the following:

  • Break down your macro into smaller, more manageable parts. This can make it run faster and make debugging easier.
  • Optimize your macro. Look for ways to reduce the number of steps or loops in your macro.

In the world of databases, automating repetitive tasks is a game-changer. By setting up your macro to run on open, you're investing time upfront to save time in the long run. So, go ahead, automate, and enjoy the efficiency boost!