Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to open a second db from within access??

Status
Not open for further replies.

woody66

IS-IT--Management
Jan 20, 2005
15
AU
Hi

I have created 2 databases, we shall call them db1 & db2, what I would like to do if possible is to put a button on the switchboard of DB1 that will allow me to open DB2 and take me to a form within that database.

Is this possible and if so how would I go about doing it?

thanks

Woody.
 
Woody66,
This will do the trick. myMacro is a macro in the database that's being opened, which contains an "Openform" action.

You may have to play with the path to msaccess.exe, depending on what version you're running.

Private Sub Command0_Click()
On Error GoTo Err_Command0_Click
Shell "C:\Program Files\Microsoft Office\Office11\msaccess.exe C:\ACCESS_XP_DBs\DUMMY.MDB /x myMacro", vbNormalFocus


Exit_Command0_Click:
Exit Sub

Err_Command0_Click:

MsgBox Err.Description
Resume Exit_Command0_Click

End Sub

Good Luck,
Tranman
 
woody66
There may be other ways, but one way is to create a Hyperlink on DB1 that opens DB2.

That will open the main switchboard on DB2, and you can navigate to the form of your choice from there...unless you set up DB2 so that it opens at the specific from you want to get to from DB1...or unless you can figure out the exact path to the form you want and include the full path in your Hyperlink.

Tom
 
Thanks guys for the help, I have also discovered another way to get the results that I wanted too.

I have created a link table in DB1 to the relevant tables that I need to access in DB2 and created my forms / reports that way.
 
woody66
Yes, you can do it that way. There are two things to remember...

1. If you move DB2, you have to refresh the links, using the Linked Table Manager.
2. Say you create a form in DB1 that is linked to a table in DB2, and you add a record. That record exists in DB1, and you may or may not want it there.

Just a word of caution.

Tom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top