MS Access not closing

ions

Access User
Local time
Today, 15:58
Joined
May 23, 2004
Messages
816
Hello

When I close MS Access which was running a database system I created, I have noticed that on occassion it doesn't close entirely.

The MS Access window disappears from the screen but the process still remains in the background. I can see the process in the Task Manager window. I have to kill the process from the TAsk Manager to fully close the database system.

This phenomena only occurs on machines running MS Access 2002. It doesn't occur on my Machine running MS Access 2003. I am not sure if the problem is a version related problem.


Thanks for your feedback.
 
just out of curiousity, are u using the following to close the program:
Code:
application.quit
????
 
Same behaviour in A2007.
 
No I am not using Application.quit. Just closing it using the X at the top of Window. Not sure wht cvajniga means by same behavior in 2007

Thanks.
 
No I am not using Application.quit. Just closing it using the X at the top of Window. Not sure wht cvajniga means by same behavior in 2007

Thanks.
Access 2007 doesn't run when I close a MDB project (say Project1.mdb) and try to re-open with/without Shift. I can open different project (Project2.ACCDB). If I leave Project2.accdb open and try to open Project1.MDB Access switches to Project2.ACCDB.
The only solution is to restart Windows... or maybe to terminate the MSACCESS.EXE process via Task Manager, see the attachment.
Ie. Access 2007 doesn't close in some occasions for an unknown reason.
 

Attachments

  • 00098-Access_process.jpg
    00098-Access_process.jpg
    74.6 KB · Views: 840
Last edited:
Yes this is what is happening with mine on my client's side, but I think it's only related to a specific .mdb (the one I developed) but I cannot confirm this at this time.

Thanks.
 
No solution for this? Having same problem. MS Access 2003. Close out of Access using the "X" close button as well as DoCmd.quit and application.quit.

But still the MSACCESS.EXE process is running after close. Have to go into task manager and end process.

Any ideas?
 
Hello

When I close MS Access which was running a database system I created, I have noticed that on occassion it doesn't close entirely.

The MS Access window disappears from the screen but the process still remains in the background. I can see the process in the Task Manager window. I have to kill the process from the TAsk Manager to fully close the database system.

This phenomena only occurs on machines running MS Access 2002. It doesn't occur on my Machine running MS Access 2003. I am not sure if the problem is a version related problem.


Thanks for your feedback.

Most of the time when I see this, it is because a recordset was opened and not properly "cleaned up" (closed, etc).

Are you opening any reocrdsets with VBA code?
 
OK, I'm willing to believe that maybe this is caused by closing the app without specifically closing each recordset you may have opened, although it sure seems like Access should do this automatically!

However, what's the best way to insure that you've done this? I try to remember to do this in my code every time I open a recordset (see below), but...

Is there some way to write code that will go in and close all recordsets? I would then attach this code to the "on close" event of my main form.

In general I've written my code this way:

On Error goto ErrHandle
set db=currentdb
set RS=db.openrecordset(mySQLString,dbopendyanset)

'(do some stuff with the recordset)

goto CloseAll

ErrHandle:
(insert error handling here)

CloseAll:
set RS=nothing
set DB=nothing
Set DB=nothing

Shouldn't this work?
 
Has anyone found a solution for this? It seems to be occuring more often.. every couple of days... on a variety of different dbs (all Access 2002) and a variety of different PC's (None running vista). It's very irritating; I'll try to start one of my access apps and it won't start, no error message, nothing. Then I'll look in task manager and lo and behold, there's still an msaccess.exe process running. After I kill it, things behave normally until.... (repeat)
 
I have the same problem with an Access 2003 .ADE project with a SQL2000 back end. However, I have noticed that when the application talks to an SQL2005 back end, it doesn't happen! Don't know if that provides a clue to anyone?

Jack
 
jevansuk,

When I installed the latest SP and Hotfixes the problem was fixed.
 
This samples of code cause the such problem in the Load, Activate, Open events of the Display Form and some other forms in my .accdb (Access 2010)

Code:
DAO method:
   CurrentDb.OpenRecordset("SELECT count(ID)...;")(0)

ADO method:
    Dim rst As New ADODB.Recordset
    rst.Open "SELECT count(ID)...", Application.CurrentProject.Connection, adOpenStatic, adLockReadOnly
    value = rst(0)
    rst.Close
    Set rst = Nothing

Execute method:
    sql = "SELECT count(ID) ..."
    Set rst = Application.CurrentProject.Connection.Execute(sql)
    value = rst(0)
    rst.Close
    Set rst = Nothing
Just moved the code to the GotFocus event to the Display Form and to the Activate event to other forms. The problem was fixed.
 
Last edited:
just for clarification, this is an old thread.

In my experience the general cause of this is an unclosed recordset preventing access closing correctly.
 
We had this problem. Turned out that - in our case - it was because we were opening a new MS Access app (App #2) from within a form's "On Load" event, and then also, closing the current MS Access app (App#1) using docmd.quit.

This managed to open App#2 but left it invisible. App#1 closed up and was gone from view. However, there would be at least one or more MSACCESS.EXE processes running still. The only way to close App#2 was to kill those processes, then open App#2 and close it.

This is how we fixed it:

Code:
[SIZE=1]' INSIDE THE ONLOAD EVENT, WE HAVE THIS CODE:[/SIZE]
[SIZE=1]' open the other Access app, App#2, from within App#1. appAccessToBeOpened.OpenCurrentDatabase publicPathAndFilenameOf2003Version[/SIZE]
 
[SIZE=1]' explicitly direct that App#2 be made visible (previously it would open as invisible)[/SIZE]
[SIZE=1]appAccessToBeOpened.Visible = True[/SIZE]
 
[SIZE=1]' now start to close the app we are inside of, App#1[/SIZE]
[SIZE=1]Application.CloseCurrentDatabase[/SIZE]
 
[SIZE=1]' Exit this sub, the On Load event, and then the On Unload Event will be kicked off[/SIZE]
[SIZE=1]Exit Sub[/SIZE]

Inside the Unload Event for this form...

Code:
[COLOR=#1f497d][COLOR=#1f497d][SIZE=1]Private Sub Form_Unload(Cancel As Integer)[/SIZE][/COLOR]
 
[COLOR=#1f497d][SIZE=1]    '  this is where the quit can work successful to quit the app.[/SIZE][/COLOR]
[COLOR=#1f497d][SIZE=1]    Application.Quit[/SIZE][/COLOR]
 
[COLOR=#1f497d][SIZE=1]End Sub[/SIZE][/COLOR]
[/COLOR]

(Note, I would have posted a link to the other thread where I posted this, however, we are not allowed to post links in this forum until after reaching 10 posts; and I just signed up today.)

- Sandi Sawyerr
w w w . LadySword . com
 
I just posted one solution to this - please search for "Sandi Sawyerr" with date of April 23, 2014, and hopefully you can find it. ( I am not allowed to post a link yet, nor can I post a duplicate post within 5 minutes.)
 

Users who are viewing this thread

Back
Top Bottom