How To Open Another Database from my Application?

  • Thread starter Thread starter Dustin Ventin
  • Start date Start date
D

Dustin Ventin

I am currently running a database that my users want to link to another
database. As part of this linkup, they want to be able to open the second
database with a click of a button in thier current Access application.

I thought this would be easy, considering I've already learned alot about
Office API's by doing like things with Project, Word, and Excel, but I can
get this file to open. I use the following code:

Dim AccessApp As Access.Application

Set AccessApp = New Access.Application

AccessApp.Visible = True
AccessApp.OpenAccessProject ("C:\xxxx\xxxx\xxxx.mdb")

The shell opens just fine, but when it comes to opening the file, I receive
an error:

"Run-time error 7866 Microsoft Access cannot open thedatabase because it is
missing, or opened exclusively by another user."

Any ideas why this is occuring? Nobody else has the database open, and my
path is correct.

Thank you!

Dustin
 
Will that allow me to programatically open forms and edit data within the
database? That may be a neccisary level of control.

Thanks!

Dustin
 
Dustin Ventin said:
Will that allow me to programatically open forms and edit data within the
database? That may be a neccisary level of control.

No, it just launches the application.

I have no idea why your other code is complaining about exclusive. However,
the example code you have is assuming an access ADP project (it not clear if
you are in fact using an access project (ADP, native sql application).

If you just using a regular mdb access application, then:use:
OpenCurrentDatabase.

You sould be using:
AccessApp.Visible = True
AccessApp.OpenCurrentDataBase("C:\xxxx\xxxx\xxxx.mdb")
 
*Blinks with confusion*

I thought I tried that code too, but now it's working perfectly...

....oh well, I won't look a gift horse in the mouth. Thank you very much!

Dustin
 
Back
Top