Using DoCmd.OpenForm within Word VBA

P

Philip Brown

Hello,

Is it possible to open an Access form from within Word VBA? If so, how do I
do it?

Any help would be appreciated, including telling me it can't be done.

Thanks!
 
J

Jay Freedman

Bearing in mind that I know nothing about Access VBA, the technique
will be approximately the same as that discussed for Excel in
http://www.word.mvps.org/FAQs/InterDev/ControlXLFromWord.htm. You set
a reference in your project to the "Microsoft Access Object Library",
and then (by properly qualifying each object in your code) you have
the full use of Access VBA within the Word macro.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
 
P

Philip Brown

Thanks, Jay,

However, I need more help than that, if it exists. I know how to open
Access recordsets from Word VBA, but I don't seem to be able to identify the
right objects to open the forms.

Philip
 
J

Jonathan West

Philip Brown said:
Thanks, Jay,

However, I need more help than that, if it exists. I know how to open
Access recordsets from Word VBA, but I don't seem to be able to identify
the
right objects to open the forms.

If you know the name of the form, and have defined an object variable for
the access application, then you use the command exactly as you do in Access
VBA, simply prefixing the name of your access object variable.
 
J

John Nurick

Hi Philip and Jay,

Automating Access is a little trickier than the other Office
applications. These KB articles are useful:

Using Microsoft Access as an Automation Server
http://support.microsoft.com/?id=147816
http://support.microsoft.com/?id=210111 (Access 2000 and later).

If on the other hand all you want to do is to launch the database and
display the form, don't bother with automation. Instead, create an
Access macro that opens the form; then launch Access with a command line
including the /x option to fire the macro.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top