Solved

DoCmd.Quit closes database, but leaves Access up

Posted on 2014-01-07
10
780 Views
Last Modified: 2014-01-09
Hello - I have one user that has recently started seeing this strange behavior in a particular app. I put a button on the main menu that issues the DoCmd.Quit command. Works fine for me, but with her, just recently, it closes the database, but leaves Access up.

Any ideas? We are both running W7 and Office/Access 2010  

Thanks
0
Comment
Question by:mlagrange
[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 57
ID: 39763467
This is due to poor garbage cleanup in Access and VBA.  When an object goes out of scope, the object is supposed to be removed from memory and any pointers cleared.  That doesn't always happen.

Access tracks open objects for use with automation and when the count reaches zero, it knows it can close.

Bugs in Access can also lead to this.

What you need to do is in code:

1. Make sure you close anything you open
2. Make sure you set object variables = nothing

ie.

  Dim rst as DAO.Recordset

  Set rst = CurrentDB().OpenRecordSet("mytable")

 .... do stuff..

  rst.close
  Set rst = nothing.

Jim.
0
 

Author Comment

by:mlagrange
ID: 39763567
Yep, I do that. But still, it's closes all the way out for me, and it used to for her, just not now.

Something has changed somehow; maybe it's one of those things that goes away with a re-install of Office/Access?
0
 
LVL 57
ID: 39763633
Does it just minimize to the task bar or does the main Access window remain up?

Jim.
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 38

Expert Comment

by:Jim P.
ID: 39763885
What happens if you change it to DoCmd.Quit acQuitSaveAll?
0
 

Author Comment

by:mlagrange
ID: 39763963
The main Access window remains up

I'll try that tomorrow. I'm also going to try Application.Quit, and see if that works for her.

Thanks, Jim. I'll be back tomorrow
0
 
LVL 75

Assisted Solution

by:DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 250 total points
ID: 39764013
This problem seems to be a lot more prevalent in A2010 that A2003. I have this issue in 3 dbs at work.  This is the 'solution' that worked for me ( if you can call it a solution):

Have your users close all open Forms/Reports before ... using the X button to close Access or a File>Exit.  Or in you case I guess since you have a main menu with a close button - have the Close button Close any open Forms/Reports before executing the Quit operation.


btw ... This article  shows you how to close all open forms. Would be similar for Reports.
mx
0
 
LVL 30

Expert Comment

by:hnasr
ID: 39764344
You need to compare settings on both machines.

Try:
DoCmd.RunCommand acCmdExit
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 250 total points
ID: 39764816
<<The main Access window remains up>>

 It's not the reference count then.   Access minimizes to the task bar when it thinks it has open references and you tell it to close.

 Just to double check, you've already updated this users copy of the app correct?   have you tried their copy of the application somewhere else?


or are you all sharing a single copy from somewhere on the network?

Jim.
0
 
LVL 37

Expert Comment

by:PatHartman
ID: 39765374
I use
Application.Quit acQuitSaveAll

Technically the acQuitSaveAll isn't necessary since the user would never be changing objects.  I use it so that when I am testing, anything I might have open that I forgot to close will be saved.
0
 

Author Comment

by:mlagrange
ID: 39768354
Hello - thank you all for all of your suggestions. This user got the same results from both DoCmd.Quit and Application.Quit

What seemed to have fixed it was just doing a Decompile on the front end.

Jim - we are both using the same front end from the network. There may be an additional complication in that she sometimes opens the app from home, over a very slow Citrix connection, and I think that might crap up the accdb to some extent during the close(particularly in Access 2010)  

Joe - I've got a fairly tight menu routine that hides the main menu when the user selects (opens) a given form, then shows the main menu when that form is closed, so I can be fairly sure that if they are closing the app form the "Exit" button on the main menu, there are no open forms.

Again - thanks everybody for your responses.

Mark
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

710 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