Can VBA open a form in an already open database?

B

billelev

I am able to use the OpenCurrentDatabse method to open a new instance
of an existing database and then open a form within that database.
However, if the database I am interested in is already open, is there
a way to open a form in the existing instance of that (already open)
database?

Thanks.

NB. The VBA code being executed exists in one database, and the form
in a different database.
 
K

Klatuu

If the database you are opening is not opened in exclusive mode, you should
be able to open it. Are you having problems with it?
 
B

billelev

If the database you are opening is not opened in exclusive mode, you should
be able to open it. Are you having problems with it?

It's not that I can't open it, but rather that it is already open.
This is what I want to do:

1. database1 - start database2 and open form1 (from vba in database1)
2. database1 - close all forms, but keep database1 open
3. database2 - after required actions, open database1 form1
4. database2 - close

I can perform steps 1,2 and 4 but I do not know how to open a form in
database1 (when the database is already open) from vba in database2.
 
B

billelev

It seems that the GetObject() function should allow you to reference
an existing instance of a database. However, when I have tried it it
opens a new instance or generates an error. It should be possible
once I figure out how to use GetObject().
 

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