Others

How to Schedule a Microsoft Access VBA Application to Run Automatically

Elise WilliamsElise Williams Oct 22, 2026 870 views

Question details

The user needs to configure a Microsoft Access application to run unattended on a recurring schedule without manual intervention.

How to Schedule a Microsoft Access VBA Application to Run Automatically
Product
Microsoft Access
Device & OS
Windows
Scenario
Automating routine database tasks, such as processing Outlook emails and saving them to network folders, so they run consistently even on weekends and holidays.
Observed behavior
The application needs to launch, execute its VBA maintenance routines completely, and then close itself automatically while the user is logged out.
Before you start

Ensure the Windows user account configured for the scheduled task has full permissions to access the mailbox, the network folders, and the specific ACCDB file.

Solution 1Recommended

Automate Access using Windows Task Scheduler and AutoExec

Set up a Windows Task Scheduler task to launch your database and use an AutoExec macro to trigger the VBA code and close the application upon completion.

To run an Access application without user intervention, you can leverage the Windows Task Scheduler combined with an Access AutoExec macro. The AutoExec macro ensures that as soon as the database is opened by the Task Scheduler, the necessary VBA code executes automatically.

It is crucial that the scheduled task is configured to run even when the user is logged out, and that your VBA code concludes with an Application.Quit command so background processes do not accumulate.

1
Create an AutoExec Macro in Access

Open your Access database. Go to the 'Create' tab and click 'Macro'. Use the 'RunCode' action to call your main VBA function. Save this macro exactly with the name 'AutoExec'.

2
Add the Application.Quit Command

Open your VBA editor. Ensure that the very last statement in your main maintenance procedure is 'Application.Quit'. This guarantees that Access closes only after all email and folder updates are fully completed.

3
Set Up Windows Task Scheduler

Open 'Task Scheduler' in Windows and select 'Create Task'. In the General tab, name the task and select the option 'Run whether user is logged on or not'. Enter the credentials of an account with appropriate network and mailbox access.

4
Configure the Task Trigger

Navigate to the 'Triggers' tab, click 'New', and set your desired schedule (e.g., Daily, Hourly, or specific days for weekends and holidays).

5
Configure the Task Action

Go to the 'Actions' tab, click 'New', and select 'Start a program'. Browse to your MSACCESS.EXE path in the 'Program/script' box. In the 'Add arguments' box, enter the full file path to your ACCDB database enclosed in quotes.

Automate Access using Windows Task Scheduler and AutoExec
Unattended Execution Tip: Double-check that your VBA code handles all potential error prompts silently, otherwise an unhandled error dialog will prevent the Application.Quit command from executing, leaving the database hanging in the background.
Free Microsoft Office alternative

Looking for a Free, Lightweight Office Suite?

While Microsoft Access handles complex relational databases, a vast majority of daily productivity tasks require simple spreadsheet data management, document editing, and presentations. WPS Office offers a completely free, highly compatible alternative to Microsoft Office for your core productivity needs.

  1. 1. Download the Installer: Visit the official WPS Office website and click the free download button for your operating system.
  2. 2. Install WPS Office: Run the downloaded setup file and follow the straightforward on-screen instructions to complete the installation.
  3. 3. Open Your Files Seamlessly: Launch WPS Office and directly open your existing Word, Excel, or PowerPoint files with zero formatting loss.
Seamlessly compatible with Microsoft Excel (.xlsx), Word (.docx), and PowerPoint (.pptx) formats.Free, lightweight suite that installs quickly and uses minimal system resources.Familiar tabbed interface makes it incredibly easy to learn and migrate.Built-in PDF editing tools for advanced document processing without extra software.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my MS Access database remain open in the background after the scheduled task runs?

This happens if the VBA code encounters an error prompt that pauses execution, or if the 'Application.Quit' command is missing or placed before the final data processing tasks are completed. Ensure 'Application.Quit' is the absolute last line executed.

Can Task Scheduler run my Access database if my computer is locked or I am logged out?

Yes. In the Task Scheduler properties for your task, you must check the box 'Run whether user is logged on or not'. You will be prompted to provide the password for the account that has the necessary permissions.

What is an AutoExec macro in Microsoft Access?

An AutoExec macro is a special macro that runs automatically whenever an Access database is opened. By naming a macro 'AutoExec' and pointing it to your VBA code, you can ensure tasks begin executing immediately upon launch without manual clicks.