...And explain "EXACTLY" what you mean by: "but of course it doesn't work"
Error message?
Screen freeze?
System crash?
Please be specific.
JeffCoachman
Main Topics
Browse All TopicsI 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.Appli
Set db = Acc.application.DBEngine.W
db.DoCmd.Openform "Name of Access Form"
Set db = Nothing
Set Acc = Nothing
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Now that I don't need this code anymore, I found out how to make it work.
I can create a public function within the Access database to open the form. Then in VB, I simply call the access function.
Here's what the VB code looks like:
Dim db As Object
Dim strFullPath As String
Dim strUser As String
strFullPath = strDBFileName
Set db = GetObject(strFullPath)
db.run "openAccForm"
ShowAccess db, 3
Set db = Nothing
So now that I've answered my own question, I guess someone can close this
Business Accounts
Answer for Membership
by: boag2000Posted on 2008-11-08 at 17:26:53ID: 22914654
Mach1pro,
I can't see where you Declared or SET strDir?
JeffCoachman