reference to the right instance of Access

L

Lauro

I need to get a reference to an already open instance of Access if it
is running or open it if not.

I'm using GetObject.

If no other instances of Access are open I have no problem. But I
have no guarantee to point to the rigth one if the user has already
opened one.

I found an half solution with a strange behavior:

Set oAccApp = GetObject(MyFileName, "Access.Application")
oAccApp.Visible = True

works fine (it open a new instance if it is not open or open and
"magically" merge it with the old one if already exists) if I don't
have a StartUp Form.

if I have a StartUp form, I tried to use:

Set oAccApp = GetObject(MyFileName, "Access.Application")
oAccApp.Visible = True
oAccApp.DoCmd.Close acForm, "Welcome Form"

But I get a run time error 2455 .

If I delete
oAccApp.Visible = True
I get multiple instances of my database.

Why?

Any Suggestions?

Thanks Lauro
 
D

david epsom dot com dot au

If I delete
oAccApp.Visible = True
I get multiple instances of my database.

If it is not visible, it does not register itself
in the list of open objects. Don't know why.
But I get a run time error 2455 .

What's that?

(david)
 

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