Close Microsoft Access After a VBA Database Backup
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.
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.
Add Application.Quit After the Backup Succeeds
Close Access from the existing VBA procedure after the backup has completed successfully.
Open the form in Design View, select the backup button, and use its property sheet's On Click event to open the VBA code.
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.
Insert `Call Application.Quit(acQuitSaveNone)` at that point. This closes Access without saving pending changes to Access objects.
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.
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.

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.




