jcaptchaos2
Well-known Member
- Joined
- Sep 24, 2002
- Messages
- 1,032
- Office Version
- 365
- Platform
- Windows
Not sure if I should post this here or on the excel board but here is my question.
I am using this code to try and open a form in access from excel, it opens the database and the form that automatically opens when the database but not the form I want. Is there a way to only open the form I want and not the main form?
I am using this code to try and open a form in access from excel, it opens the database and the form that automatically opens when the database but not the form I want. Is there a way to only open the form I want and not the main form?
Code:
Sub OpenAccess2()
Dim ac As Object
On Error Resume Next
Set ac = GetObject(, "Access.Application")
If ac Is Nothing Then
Set ac = GetObject("", "Access.Application")
ac.OpenCurrentDatabase "N:\Fishbowl Databases\Labor Collection Min.accdb"
ac.DoCmd.Openform "Earned Hours_Cast"
ac.UserControl = True
Set ac = Nothing
End If
AppActivate "Microsoft Access"
End Sub