Solved

DoCmd.Quit Very Slow

Posted on 2008-06-09
10
591 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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
 
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

861 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