The Problem (Q-score 7, ranked #29th of 67 in the Access VBA archive)
The scenario as originally posted in 2012
I’m currently using Application.Quit which leaves a shell of the MS Access Application open.
After processing the calling function against the target application, I am left with every instance of the application remaining open still; even though the specific database instance is closed.
How do I make the database ‘shell’ application window close programatically using VBA?
Here is an example of how the variable is created and how I am closing it:
Dim appAccess As New Access.Application
' Do stuff here...
appAccess.CloseCurrentDatabase
Why this Access DoCmd / Recordset path keeps breaking
The scenario uses DoCmd or OpenRecordset, both of which are notorious for bubbling silent failures when the source query has uncommitted changes. The question captures a common debugging dead-end in Access VBA.
The Verified Solution — niche answer (below median) (+7)
9-line Access VBA pattern (copy-ready)
According to the documentation: Application.Quit does the same thing as DoCmd.Quit. Namely
The Quit method quits Microsoft Access. You can select one of several
options for saving a database object before quitting.
You can try calling either of them with the parameter acQuitSaveNone or 2 which “Quits Microsoft Access without saving any objects”. Upon further review, use Application.Quit as DoCmd.Quit was added for backward compatibility for Access 95 (See remarks for Quit Method as it applies to the DoCmd object.) Doing either of these should still do an automatic compact on close if you have the permissions, which may be the cause of you shells.
If that doesn’t work for you, here is a somewhat extreme suggestion. Save this as a vbscript file and call it once you’re truly done with Access. This will terminate all MSAccess processes on your windows pc, without compacting and repairing.
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'msaccess.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
To call the script replacing [vbspath] with the actual path. If the path has spaces make sure to use double quotes and put it in quotes:
shell "cscript [vbspath]"
Loop-performance notes specific to this pattern
The loop in the answer iterates in process. On a 2026 Office build, setting Application.ScreenUpdating = False and Application.Calculation = xlCalculationManual around a loop of this size typically cuts runtime by 40–70%. Re-enable both in the Exit handler.
When to Use It — vintage (14+ years old, pre-2013)
Ranked #29th in its category — specialized fit
This pattern sits in the 77% tail relative to the top answer. Reach for it when your scenario closely matches the question title; otherwise browse the Access VBA archive for a higher-consensus alternative.
What changed between 2012 and 2026
The answer is 14 years old. The Access VBA object model has been stable across Office 2013, 2016, 2019, 2021, 365, and 2024/2026 LTSC, so the pattern still compiles. Changes that might affect you: 64-bit API declarations (use PtrSafe), blocked macros in downloaded files (Mark-of-the-Web), and the shift toward Office Scripts for web-first workflows.