VBA & Macro Problems

Close Microsoft Access After a VBA Database Backup

Camila MilosovichCamila Milosovich Nov 20, 2026 868 views

Question details

The user wants Microsoft Access to close automatically after a form button runs a database backup procedure.

Product
Microsoft Access
Device & OS
not provided
Scenario
A form button starts a VBA procedure that backs up the database.
Observed behavior
The backup procedure runs successfully, but Access remains open afterward.
Before you start

Identify the successful completion point in the button's backup procedure and check whether the copy operation finishes synchronously. Be aware that acQuitSaveNone closes Access without saving pending changes to Access objects.

Solution 1Recommended

Add Application.Quit After the Backup Succeeds

Close Access from the existing VBA procedure after the backup has completed successfully.

1
Open the button's VBA procedure

Open the form in Design View, select the backup button, and use its property sheet's On Click event to open the VBA code.

2
Find the success path

In the VBA editor, locate the point immediately after the backup copy has completed successfully and before the procedure's Exit Function statement. Ensure error-handling paths do not reach the quit command.

3
Add the quit command

Insert `Call Application.Quit(acQuitSaveNone)` at that point. This closes Access without saving pending changes to Access objects.

4
Test the button

Save the code, return to the form, and click the backup button. Verify that the backup is created before Access closes; also test that a backup failure does not trigger the quit command.

If the copy requires the database to be closed: A procedure running in the current database cannot continue executing there after that database is closed. If your backup method requires exclusive access, use an external script or a separate controller database to close the source database and then copy it.
Free Microsoft Office alternative

Work With Office Documents in WPS Office

WPS Office is a free, lightweight alternative for everyday documents, spreadsheets, and presentations. Its familiar interface and Microsoft Office format compatibility make moving existing files straightforward. It does not run Access databases or fix Access VBA procedures.

Work with documents, spreadsheets, and presentations in one lightweight suiteOpen and edit Microsoft Office formats such as DOCX, XLSX, and PPTXUse a familiar interface when moving from Microsoft OfficeReview backup-related notes and spreadsheets alongside other Office files
microsoft office alternative - wps office

Frequently Asked Questions

Where should I put Application.Quit in my backup function?

In the VBA editor, place `Call Application.Quit(acQuitSaveNone)` immediately after the successful backup copy and before Exit Function. Keep it out of error-handling paths.

What does acQuitSaveNone do?

It tells Access to quit without saving pending changes to Access objects. Save any object changes you want to keep before running the backup button.

Will Access wait for an external backup process to finish?

Not necessarily. If your VBA code launches an asynchronous process, add a way to wait for and verify its completion before calling Application.Quit.

How can I back up the database if the copy needs exclusive access?

Use an external script or a separate controller database to close the source database before copying it. Code running inside the source database cannot continue there after it closes.