Open multiple databases

  • Thread starter Thread starter bassplayer
  • Start date Start date
B

bassplayer

Hi
I have 2 databases which i use at work. i would like to put
button on a form in database 1 to open database 2. Is this possible
When i try using the RunApp macro i get an error message. Any hel
will be greatly appreciated

Thank
 
Use the Shell function

shell("C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE
c:\aaaa\db1.mdb")
 
This code should do the trick

Private Sub cmdOpenAnotherDB_Click(
On Error GoTo Err_cmdOpenArchives_Clic

Dim stAppName As Strin

stAppName = "C:\Program Files\Microsof
Office\Office11\msaccess.exe " & "u:\Access\PathName
'MsgBox "appName is " & stAppNam
Call Shell(stAppName, 1
DoCmd.Qui
Exit_cmdOpenArchives_Click
Exit Su

Err_cmdOpenArchives_Click
MsgBox Err.Descriptio
Resume Exit_cmdOpenArchives_Clic

End Su

This code is to open another DB in another drive. Just substitute you
own pathname
 
Use the following:

application.FollowHyperlink "c:\path to database\mycoolapp.mdb"

If you are going to use the shell funciton, then don't hard code the path to
maccess.exe, as that will cause problems when you move to a differnt pc
where the location is changed.
 
Back
Top