Is it possible to open one ms access database from another ms database?

I have a group of 20 or so MS Access Databases that are the interfaces to generate drawings thru another program. I would like to create a Main Menu so the user can choose which of the 20 interfaces they want to open.

I have been able to link the databases (thru a control button wizard and code) so that a table is imported into the main menu database following the information at the link below:
http://office.microsoft.com/en-us/access-help/about-importing-and-linking-data-and-database-objects-HP005241695.aspx


but I want the individual databases to open.
Is this possible?
Answer
Answer

Check, and then double-check that the path and filename in

 

 OpenAnotherDb "C:\Users\Owner\Documents\EMS\Synth16\Access\emscomdb\square_pocket.mdb"

 

are absolutely correct.

---
Best wishes, HansV
https://www.eileenslounge.com

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Answer
Answer

Hans' suggestion is a good one but sometimes there are issues (security warnings that pop up) with using hyperlinks, so if you run into that issue, you can use this code instead if you want:

 

Function OpenAnotherDb(FileName As String, Optional PWD As String)

      Dim objAcc As Object

      Set objAcc = CreateObject("Access.Application")

      If Len(PWD) > 0 Then

          objAcc.OpenCurrentDatabase(FileName, , PWD)

      Else

          objAcc.OpenCurrentDatabase(FileName)

      End If

      objAcc.Visible = True

      objAcc.UserControl = True

     Set objAcc = Nothing

End Function

 

 

So you can put that into a standard module and name the module (if it isn't an existing one) something OTHER than the name of this function.  Then you can just call it like:

 

OpenAnotherDb \\ServerName\ShareName\Folder\MyDb.accdb

 

and if it has a password set on it (not User Level Security but just a database password) you can use:

OpenAnotherDb \\ServerName\ShareName\Folder\MyDb.accdb, "YourPasswordHere"

 

The part of objAcc.UserControl = True is the part that releases it from the control of the database which opened it so you can then set the object to nothing but the database will remain open. 

-----
Microsoft Access MVP 2008, 2009, 2011
If a post was helpful click the FOUND THIS HELPFUL link

1 person found this reply helpful

·

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated April 25, 2024 Views 1,980 Applies to: