Feb 02 2022 01:36 AM
Since yesterday I noticed that in all my Access databases there is a problem when I close them.
When I close a database, it leaves a background process that can only be terminated in Task Manager. Without this, it is not possible to (re)open databases!
I have already checked some possible causes. It also concerns databases that I have not changed at all in recent months and that worked fine until this week. Therefore, I have to assume that it is a bug in an automatic update!
It seems that it has to do with a malfunction in the deallocation of allocated memory in VBA source code.
Did anyone experience the same problem? Are there already fixes or solutions available?
Jun 25 2023 01:00 PM
Jun 26 2023 10:18 AM
@JEEDEE23 Hi! This issue got resolved last year. MS released a bad version of Access. Once the released the fixed version everything was fine and back to normal. Glad you fixed your issue. :)
Jul 11 2023 04:57 PM
Aug 12 2023 03:02 AM
close access with a button on your form invoking this event, it always works, of course a non saved record, will not be saved.
x = Shell ("cmd.exe /c TASKKILL /F /IM msaccess.exe")
Aug 13 2023 12:14 PM
As Coskerk says "This issue got resolved last year. MS released a bad version of Access. Once the released the fixed version everything was fine and back to normal."
The issue disappeared for me about 8 months ago after MS issued an update. My updated Access installs have been operating without this issue for quite some time.
Karl Donaubaur was correct when he cited an MS update as the source of the problem shortly after it happened. I well remember the panic it created.
Aug 13 2023 04:20 PM
Aug 14 2023 05:24 PM
Aug 15 2023 03:17 AM - edited Aug 15 2023 03:53 AM
Yes, that could be a solution. Me too, I installed brand fresh win 11, but let the office 365 run from the cloud.
Let it be clear, I only have this issue the moment I start using the database, it is quite full with code. But normally the docmd.quit acsaveAll works fine, until recently...
Can you tell me the offline 64-bit downloadable version or send me a link to it?
The behaviour starts, the moment one changes any record in any table, but only in a form. Changing a lot of records, even in related tables, in the source tables, without even opening a form, does close access properly.
To be clear, this database is 10 years old and always closed properly. (upgraded it to 64-bit around 5 years ago)
Aug 15 2023 07:31 AM
Aug 15 2023 08:58 AM
@Tho_Map That is correct. The 'taskkill' is therefore only to be used if one is sure, everything is saved. So if you are editing a record, and click on the quit button whitout saving that edited record, the record is not saved.
Well, you speak about workaround, as far as I could detect, this is the only one. (you can also invoke the taskkill in an 'on close' event:
When you close a form, the Exit and LostFocus events occur before the events associated with closing the form (such as Unload, Deactivate, and Close), as follows:
Exit (control) -LostFocus (control) -Unload (form) -Deactivate (form) -Close (form)
source here
Aug 15 2023 11:39 AM
@JEEDEE23 Thanks for your reply and explanation.
A user will sometimes have multiple access front-ends open at the same time so I needed to taskkill by process ID so the close button only closes the current db. I added this function to a module to get the process ID of the current db (http://allapi.mentalis.org/apilist/GetCurrentProcessId.shtml_:
Declare Function GetCurrentProcessId Lib "kernel32" Alias "GetCurrentProcessId" () As Long
Our Infosec group doesn't allow us to call cmd.exe so I used powershell instead to call taskkill:
Shell ("powershell taskkill.exe /f /t /PID " & GetCurrentProcessId)
I noticed that sometimes the lock file does close? Maybe the slight delay sometimes when calling the shell allows the Application.Quit or DoCmd.Quit to complete and close the lock file?
Aug 15 2023 03:32 PM
Another variation on the same theme
I have an analyzer app that checks on the properties of external Access databases using automation.
To ensure the background Access process is terminated when I close the analyzer (or change to view details of another database, I use WMI to kill that Access instance:
'kill any existing instances of appAcc & hence leftover instances of Access in task manager
'this causes error 91 if appAcc not yet created e.g. when form first loaded
'use error handling in such cases
30 With appAcc
40 .CloseCurrentDatabase
50 DoEvents
60 If Application.hWndAccessApp = appAcc.hWndAccessApp Then WMI_KillProcess "MsAccess.exe"
70 DoEvents
80 .Quit
90 DoEvents
100 End With
Aug 16 2023 01:31 AM
Indeed, your solution (which is of course an unusual workaround) is more accurate.
Concerning your last remark: you can check that:
Shell ("powershell taskkill.exe /f /t /PID " & GetCurrentProcessId)
docmd.quit acSaveAll
if the .laccdb has disappeared, access was closed, if it is still there, access was only killed. You should put it like this then
Shell ("powershell taskkill.exe /f /t /PID " & GetCurrentProcessId,false)
that way, access won't wait for the shell command to finish and proceed to the next line.
Aug 16 2023 05:42 PM
@JEEDEE23I've been dealing with this problem since moving to Win11 and Office 365.
The problem (zombie processes) seems to be related to using either docmd.quit or application.quit to close your Access db.
Also, why should a user/customer have to kill zombie processes? Shouldn't MS handle this?
Shell ("powershell taskkill.exe /f /t /PID " & GetCurrentProcessId)
Rod
Aug 17 2023 04:25 PM
Aug 19 2023 12:21 PM
Aug 19 2023 12:31 PM - edited Aug 19 2023 12:34 PM
Hi, yes for sure I read all of it, but as many persons indicate, Microsoft should address this.
Anyway:
Thanks for answering and keeping this issue alive, it is possible we don't talk about the same causes but certainly about the same results: Using an MS database with some vba code, and closing the database with the X worked until somewhere during 2022, and since then, closing MS Access 'the normal way' is impossible. For me: English Version of today Dutch keyboard and time zone, and Belgian regional settings (veeeerrryy important to know, because this causes sometimes other issues)
Aug 19 2023 05:13 PM
Aug 21 2023 06:10 AM
Normally they should be able to track this through the proces monitor tool:
https://learn.microsoft.com/en-us/sysinternals/downloads/procmon
It will clearly state what is wrong, but I think due to privacy reasons, they don't use this tool much (certainly won't demand you to do it)
Jan 14 2024 01:08 PM