Re: MS Access 2000 Automation, can't quit process...

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Richard T. Edwards_at_pwpsquared.net (Edwards_at_pwpsquared.net)
Date: 02/26/04


Date: Thu, 26 Feb 2004 12:45:30 -0800

Place:

Dim o as Access.Application

Above your first event. By default that should be the form_Load.

This way, all events will be able to see that instance.

"David Conorozzo" <dave.conorozzo@formrouter.net> wrote in message
news:E43D42EF-DC65-4010-BB61-76AA873234F6@microsoft.com...
> I create a new Access.Application instance. As soon as I refernce the
property "References", I am unable to issue a truly successful quit on that
instance. By that I mean the call to quit is fine but if you look in task
manager, the instance is still running. Furthermore, if you opened a
database using that instance, you will not be able to open it until you quit
the entire application or until you kill that process. BTW, the process is
killed automatically on successful exit of the application (but it doesn't
get killed if you simply go out of scope). I am interested in whether or
not this is a real bug, or if there is a service pack or if it affects other
versions of Access. To replicate:
>
> Create a new Windows Form Application. Add a reference to the Microsoft
Access 9.0 Object Library COM component (this will automatically add some
other references). Add a button to your form. In the click event for that
button do something like (VB.NET):
> Dim o As Access.Application
> o = New Access.Application
> o.OpenCurrentDatabase("c:\somedb.mdb", False)
> Dim x as Integer = o.References.Count
> o.CloseCurrentDatabase()
> o.Quit
>
> Set a breakpoint on the End Sub line. Open task manager and you should
see an instance of MSACCESS.EXE still running.
> Let the program get out of the Sub (exit that scope) and you will see that
the instance is still running. Exit the application normally (no errors,
don't kill the application) and you will see that the OS properly kills the
instance with the application.
>
> Run this again but take out the line: "Dim x as Integer =
o.References.Count" and you will see that at the end of the sub, the
instance is not there. I have a bunch of code like this and no other lines
are causing this to happen, i.e. if I take out the few lines of code that
reference "References", all instances of MSACCESS.EXE exit properly.
>
>


Quantcast