PDA

View Full Version : Opening an Access Form via Excel



mferrisi
07-24-2007, 06:17 AM
The following code is run when a button is clicked on an excel sheet. When the code is run, the menu of tables opens in excel (not access). However, if I follow the folders from the desktop and click on Univ_Master.mdb, the access file opens, and the Form is displayed.

I need the code to open the access form (in access), not the tables or the other views. I hope that makes sense.

Thank you,

Matt


Private Sub CommandButton1_Click()
Workbooks.Open Filename:= _
"\\fil01ntu1p\sm$\Wayne\Univ_Master.mdb (file://\\fil01ntu1p\sm$\Wayne\Univ_Master.mdb)"
End Sub

rory
07-24-2007, 06:35 AM
Something like:
Private Sub CommandButton1_Click()
Dim objAccess As Object
Set objAccess = CreateObject("Access.Application")
objAccess.OpenCurrentDatabase (file://fil01ntu1p/sm$/Wayne/Univ_Master.mdb)
objAccess.Visible = True
End Sub


Regards,
Rory
PS I am assuming your Form loads automatically.