Solved

DoCmd.Quit Very Slow

Posted on 2008-06-09
10
593 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 66

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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

717 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