Link to home
Start Free TrialLog in
Avatar of Mach1pro
Mach1pro

asked on

Need to open a form in Access from a visual basic exe

I Need to be able to open a form in an Access 2007 database from a vb form.
The database WILL already be open, but could be minimized or maximized when the vb form code runs.
So I need specific code to connect to the database and then open the form.
Here's kind of what I'm after, but of course it doesn't work:

Dim Acc As Object, db As Object
Dim strFullPath As String
strFullPath = strDir & "Database Name.accdb"
Set Acc = CreateObject("Access.Application")
Set db = Acc.application.DBEngine.Workspaces(strFullPath)
db.DoCmd.Openform "Name of Access Form"
Set db = Nothing
Set Acc = Nothing
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Mach1pro,

I can't see where you Declared or SET strDir?

JeffCoachman
...And explain "EXACTLY" what you mean by: "but of course it doesn't work"

Error message?
Screen freeze?
System crash?

Please be specific.

JeffCoachman
ASKER CERTIFIED SOLUTION
Avatar of Mach1pro
Mach1pro

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You must click the request attention button.