to VanThien Dinh

  • Thread starter Thread starter David
  • Start date Start date
D

David

You responded to the following post
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?

This is how you responded

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.)


I have the problem as the createobject is creating an
object of the latest installed version of Access
and I want to open an Access97 database. You said it can
be done but more complex.
Can you advise how to do it.
Thanks.
 
Assuming you have Access 97 installed on the machine, try

Set oApp = CreateObject("Access.Application.8")
 
Douglas show you how to create an Access 97 application
object if you have multiple versions of Access installed
on your PC.

For the current directory (of the calling database), I
think you need to use the expression:

Left(Currentdb.Name, len(currentdb.Name) -
Len(Dir(Currentdb.name)))

(typed as one line).

HTH
Van T. Dinh
MVP (Access)
 
I must remember to read all of the question(s).
I must remember to read all of the question(s).
I must remember to read all of the question(s).
 
Back
Top