MS-ACCESS.EXE COM Server Remains in Memory after "-2147417851 Automation error. The server threw an

G

Geoff

Hi, all

I am automating Access 2003 (Server) from another Access 2003 DB (Client).

Depending upon the existence of some objects in the Server DB, the Client
VBA will receive the error:

"-2147417851 - Automation error
The server threw an exception."

I have looked around, and see that this error has cropped up in discussions
before.
My error handler checks for this error code, and resumes succesfully.

The issue I am finding difficult to handle is that if the server throws an
exception, then the process of closing the server fails silently at the end
of the client function, leaving an instance of MSACCESS.EXE running in
memory, but not visible - even if the server is made visible when it is
being used!

The code is:

Set oAccess = New Access.Application
oAccess.OpenCurrentDatabase "C:\Test.mdb"

' do some automation things here....
' cause the "-2147417851 - Automation error. The server threw an
exception."

oAccess.CloseCurrentDatabase
oAccess.Quit
Set oAccess = Nothing ' <-- after "-2147417851 - Automation error - this
does not end the MSACCESS Server process.

My question is:

Is there a way to ensure the server instance is properly closed?
 
G

Guest

Access won't close unless it can release all of it's memory/resources.
If it looses track of an object, it won't be able to release it, and Access
won't close.

Either
a) don't do that. Find what is throwing the exception, and fix it.

or

b) live with it

or

c) Find a Windows API that kills processes. I think syscmd(602) returns a
process number.
Killing the process won't release the resource that Access lost, and you
will have a resource leak of some kind.

(david)
 
T

TC

Maybe not the cause of your problem, but, there is an article somewhere
in the MS KB which recommends using createobject (not the 'new'
keyword) to instantiate new objects. I could possibly find that article
again if I had to. So try:

set oAccess = createobject ("access.application")

& see if that helps.

Also, precisely what actions cause the automation error?

Are you sure that one or both database do not have a missing reference
(tools:references)?

HTH,
TC
 
G

Geoff

Thanks, David,

(Had a few days of being too busy to check back...)
I found some example code that is designed to terminate an application.
I am sure it works, but it causes an extra automation error, and access
crashes 'visibly'.

Given that the function causing the exception is internal to Access (2003),
and that I now know some of the reason(s) why an exception is generated, I
will approach the problem from a different perspective - since I don't
intend to have to live with such a messy outcome.

Finally, FYI, I was working with the ObjectDependencies functionality - its
good except for these automation errors!.

Geoff
 
G

Geoff

HI, TC and thanks,

(Had a few days of being too busy to check back...)

Tried the createojbject - no difference. No missing references.

Finally, FYI, I was working with the ObjectDependencies functionality - its
good except for these automation errors!.

Geoff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top