Solved

DoCmd.Quit Very Slow

Posted on 2008-06-09
10
583 Views
Last Modified: 2012-06-27
I have a quit button on a form, the event for onclick calls DoCmd.Quit. It takes about 45 seconds for access to close once this button is pressed.

How can I fix this?
0
Comment
Question by:bejhan
10 Comments
 
LVL 75
ID: 21745294
Is there any code or process running prior to the Quit command - such that Access would have to wait?

mx
0
 
LVL 1

Author Comment

by:bejhan
ID: 21745363
Nothing at all. And there are other buttons to open other forms and close the current form and pressing those buttons opens the forms quickly. So if access had to wait those would take long as well right?
0
 
LVL 65

Accepted Solution

by:
Jim Horn earned 100 total points
ID: 21745582
Give this a whirl...

DoCmd.Quit acQuitSaveNone

This assumes that there are no updates pending that you care about when code hits this line
0
 
LVL 75
ID: 21745605
Before you close ... open Task Manager, select the Process tab ... and see is Access is eating up resources during this long close.

mx
0
 
LVL 1

Author Comment

by:bejhan
ID: 21745692
DoCmd.Quit acQuitSaveNone worked like a charm. I'm not quite sure what is saved at this time. For example what if a process I ran modified some tables etc. Would these changes be saved at the DoCmd.Quit or at the time of the process end? Because I wouldn't want to lose those changes.

During the long close access fluctuates between 1-9% of CPU and about 20,000K mem usage, so nothing too crazy.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 8

Expert Comment

by:Emil_Gray
ID: 21745733
I would suggest using the following.

DoEvents
DoCmd.Quit acQuitSaveNone

to ensure all of your updates are completed before quitting the application.
0
 
LVL 75
ID: 21745764
Just an fyi ... DoEvents allows Windows to 'update' other screen things - not Access updates per se.

mx
0
 
LVL 1

Author Comment

by:bejhan
ID: 21747018
So what is saved at the time of DoCmd.Quit. Is it all table changes made throughout the running of the app?
0
 
LVL 75
ID: 21747156
From Help:

Setting
The Quit action has the following argument.

Action argument Description
Options Specifies what happens to unsaved objects when you quit Access. Click Prompt (to display dialog boxes that ask whether to save each object), Save All (to save all objects without prompting by dialog boxes), or Exit (to quit without saving any objects) in the Options box in the Action Arguments section of the Macro window. The default is Save All.

mx
0
 
LVL 15

Expert Comment

by:cquinn
ID: 21750511
It will also be slower if you have set the database to compact on exit
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now