1
votes

Can someone please point me in the right direction, or know of a way to open an Access2007 database file housed on a network shared drive, from a button within another Access2007 Database which is also saved to the same network shared drive, just a different folder? I.E. I have Datebase2.accdb saved to a shared network drive folder, I've created a button on frm_dashboard of Database1.accdb and no matter what I do I cannot get the button to open Database2 from the shared drive folder. I even tried setting the hyper-link to the file as someone suggested and that won't open Database2 either. Macros seem to only set the on open event from within the current database you have open. I haven't been able to find VBA to do this either.

1
My apologies, yes that is correct. I am trying to get Database2 to open in a new Access application and run along side of Database1. Users would need to have access to both applications concurrently. Thank you HansShaun K

1 Answers

0
votes

Create a new Access application session and open your other database in that session.

This is the Click event procedure for a command button named cmdOtherDb:

Private Sub cmdOtherDb_Click()
    Dim objAccess As Access.Application
    Dim strPath As String
    strPath = "C:\share\Access\Northwind_2007.accdb" ' <-- change this
    Set objAccess = New Access.Application
    objAccess.UserControl = True
    objAccess.OpenCurrentDatabase strPath
    Set objAccess = Nothing
End Sub