Using CreateObject to run a 2nd instance of MSAccess

  • Thread starter Thread starter Jim Pockmire
  • Start date Start date
J

Jim Pockmire

The following code will open up a 2nd instance of MSAccess.

Dim oApp As Object
Set oApp = CreateObject("Access.Application")
oApp.Visible = True

1. How can I open a specified mdb after starting the 2nd instance?
2. What if I do not know the exact path to the mdb above, only that it
resides in the same folder as the mdb in the 1st instance?
 
oApp.OpenCurrentDatabase ....

If you don't know the path except it is the same as the database in the
current instance of Access:

oApp.OpenCurrentDatabase CurrentProject.Path & "\" & {FileNameHere}...

(for A2K or later. For A97, slightly more complex but still can be done.)

See Access VB Help on OpenCurrentDatabase for other arguments.
 
Back
Top