top of page

Hanging instance of Access after closing a database

Updated: 3 days ago

Description

You close a database and supposedly terminate Access. After that, databases can no longer be opened by clicking on the file in Windows Explorer or on a shortcut. The result is only a lock file (laccdb) visible in Explorer. If you open Access first, databases can be opened from there. The problem has arisen in the last few weeks or months, even with databases that have been working for years.


The reason for this behaviour is a hanging instance of the msaccess.exe, which you can see and terminate in the Task Manager. However, the problem recurs, either constantly or only from time to time.


All Access versions from 2016 to 365 in all current 240x and beta versions seem to be affected, both on Windows 10 and 11. There are several discussions about the problem, e.g.



Cause

There have been reports of this type of problem in the past. The reasons were bugs or the installation of other programs such as Grammarly. However, recently the number of reports has increased dramatically. So we assume that there is a new variant with a much wider distribution.


In the above-mentioned TechCommunity thread the affected user "CampDirector" posted the following scenario:


  1. Close all Access DBs.

  2. Go to Windows Settings, Accessibility (left hand menu).

  3. Click on Text Cursor and enable Text Cursor Indicator "ON"

  4. Open Access DB, then close it.

  5. Trying to open it again does not work, MSACESS.EXE still running, only way is to end task.

  6. To get your computer "back to normal", simply disable Text Cursor Indicator, and Access opens and closes normally.


This scenario is reproducible for several people and also within the AFo team. For some with every database, for others only if they set the Text Cursor size to maximum and not with all databases.


On May 14, Colin Riddington found two more accessibility settings that trigger the hanging task "reliably": Screen Magnifier and Narrator

However, the problem occurs for many people without this accessibility settings enabled. Therefore, there must be also other or root causes.


Status

Microsoft is planning a fix with version 2405, which will be released around the end of May.


Workarounds

The only workarounds we know so far are the various ways to forcefully terminate the open or hanging Access task.


Several methods are mentioned in the comments to this article. Caution is advised here, as forcibly terminating tasks can be problematic in two ways: Some methods terminate all running Access tasks, i.e. potentially more than intended, and there is always a residual risk of damaging the affected Access files.


In his comment here, Keimpe Wiersma mentions the easy-to-use API function EndTask to reliably terminate the current Access task from within the application.


Another method to do this is the API function TerminateProcess. Philipp Stiefel explains it in this video and offers an example file: Windows API in VBA – Terminate Process – Workaround for Access Hanging on Close


420 views9 comments

9 Comments


I would only recommend using a forced shutdown as a last resort because it can cause damage to any open Access database.

However, to add to the 2 methods described by @Gontran Harvey and @Keimpe Wiersma, you can do this very easily without using PowerShell or any APIs. Instead, run the following from a command prompt, script or shortcut :

cmd /c taskkill /F /IM "msaccess.exe"

It will terminate ALL open instances of Access. If Access isn't running, you will get a message that the process msaccess.exe was not found

Like
Replying to

I would still far prefer to use either of the other two methods and even then only in the event of a normal close failing leaving a hanging instance.

For info, none of the methods suggested in these comments deletes the lock file.

Like

Keimpe Wiersma
Keimpe Wiersma
May 07

Plagued by this bug, I fixed it by having Access kill its own process when the main form of the application closes. It's very simple. Put this line in a module:


Public Declare Function EndTask Lib "user32.dll" (ByVal hWnd As Long, ByVal fShutDown As Boolean, ByVal fForce As Boolean) As Long


and put these lines in the OnClose event of your main form:


Dim hWnd As Long

hWnd = Application.hWndAccessApp

Call EndTask(hWnd, False, True)


Further information: because the above procedure may damage the Access file, the application is started every time by a .bat file that copies a fresh Access file from the file server to a local directory and launches it.

Like

Jonathan Biedermann
Jonathan Biedermann
May 06

Silly me, I just tried it... It works great! This will certainly help out A LOT in the meantime.

Like

Jonathan Biedermann
Jonathan Biedermann
May 06

Hey there, I'm the "CampDirector" mentioned in this post. My issue is that two new camps are starting to use the software I created in Access years ago. It works fine on all other (granted older) windows laptops, running 10 or 11. But these two are brand new, and every single time they quit, Access hangs. They have the latest updates and the program is in a trusted directory and ALL trust settings are disabled (in the sense to allow any code to run... I do create fixed length reports which needs to delete (kill) files on the host computer, so I think it's flagged for that).


Again, I have zero issues on my own dev laptop, except when I…

Like

Gontran Harvey
Gontran Harvey
May 06

HMG, I have this bug for years now!!!. I just decided to live with it. Sometimes I try to compact a database and I have this message that it's already opened (in my development environment). So when it appends, I have this shortcut to kill all Access on my machine. Sometime I close a database and it closes but Access reopened by itself on the "New" Windows. I never have a user complain about it. I don't know if it's because they have an accde. It only appends in my environment.


Here the windwos shorcut: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command Stop-Process -Name "MsAccess"

Like
Jonathan Biedermann
Jonathan Biedermann
May 06
Replying to

Hi Gontran,


So you are saying just create this as a shortcut and have the user run it if they can't open a database? Will check myself, but any issue if Access is not open?

Like
bottom of page