X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
   Reply to this topicStart new topic
> Docmd.quit And Application.quit Crash Access, Access 2010    
post Sep 24 2014, 12:50 AM

Posts: 921
Joined: 1-October 10
From: North of the 49th Parallel

Does anyone know of the proper way to utilize either of these two commands to do a safe closure of Access?
Originally I had a DoCmd.Quit inside a form subroutine but Access continuously crashes when it reaches the command no matter how I try to execute it.
I've also run a loop to close all loaded forms in the application prior to triggering the command but still a crash.
More recently I've moved the command to a class event that is triggered after the form is closed - that too causes Access to crash.
Any thoughts on this?
Go to the top of the page
post Sep 24 2014, 06:51 AM

UtterAccess VIP
Posts: 6,135
Joined: 30-June 11

I've used both in past projects and never experienced any problems.
Does your code compile?
What error does Access report exactly?
Very odd... iconfused.gif
Go to the top of the page
post Sep 24 2014, 01:47 PM

Posts: 921
Joined: 1-October 10
From: North of the 49th Parallel

No error, just a complete crash of the application.
I've been able to at least get it to the point where the forms will close and the application will close, but now I'm getting a Windows Recovery prompt and the trusty ol' "windows will restart your program" screen. I don't want this to happen. Grr... not an easy one to troubleshoot either.
Go to the top of the page
post Dec 27 2017, 12:50 PM

Posts: 1
Joined: 27-December 17

I'm running MS Office 2000 on Window 10 and I have the same problem. Looking at eventvwr application log, it appears that the OS (ntdll.dll) is no longer fully compatible with the DoCmd.Quit method:

Exception code: 0xc0000027
Fault offset: 0x00061057
Faulting process id: 0x84c
Faulting application start time: 0x01d37eb2965cc17a
Faulting application path: C:\Program Files (x86)\Microsoft Office\Office\MSACCESS.EXE
Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll

Rather than upgrade my 18 year old Office version, the best way for my situation is to brute force it by killing the MSACCESS.exe processes. This will work for you as well.

Remove "DoCmd.Quit" from your button or where you call it.

Add Sub to kill MS Access. Just to be clean I closed everything down first which is probably not necessary.

Dim MyDB As Database
Set MyDB = CurrentDb()
Set MyDB = Nothing


'This is the important part here. KillAccess Sub below
Private Sub KillAccess()

Dim oServ As Object
Dim cProc As Variant
Dim oProc As Object
Dim errReturnCode As Variant

Set oServ = GetObject("winmgmts:")
Set cProc = oServ.ExecQuery("Select * from Win32_Process Where Name = 'MSACCESS.EXE'")

For Each oProc In cProc
If oProc.Name = "MSACCESS.EXE" Then
errReturnCode = oProc.Terminate()
End If

End Sub

This post has been edited by zzz888zzz: Dec 27 2017, 12:59 PM
Go to the top of the page
post Dec 27 2017, 01:18 PM

Access Wiki and Forums Moderator
Posts: 73,527
Joined: 19-June 07
From: SunnySandyEggo

Hmm, I also don't have this problem, but I also don't have the mentioned configuration. I either have 2010 on Win7 or 2013 on Win10. Are you okay when using DoCmd.CloseDatabase, or does it crash as well? Just curious...
Go to the top of the page

Custom Search
RSSSearch   Top   Lo-Fi    23rd October 2018 - 06:35 AM