By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,327 Members | 1,806 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,327 IT Pros & Developers. It's quick & easy.

Using VBA to toggle from MS Word to MS Access?

P: n/a
Access 2003, Windows XP SP2

I have an application that generates a word document populated with a
variety of fields from Access tables.

The word document is generated when the user presses a button
(cmdGenerateAgreement) on a form (frmTransaction).

I want the process to work as follows:
1. User presses button
2. Word document is opened and populated
3. Access screen becomes visible with a message box
4. User presses Ok
5. Word screen becomes visible for finalization

My question is how do I achieve steps 3 and 5?

I've tried SetFocus, Access Web's API: Manipulate Window
(fSetAccessWindow), and a lot of browsing in the newsgroups. Nothing
seems to work.

My guess is that this functionality will require a call to the Windows
API. I've read all the relevant sections in my Access books, and
nothing specific to this situation is mentioned.

Can this functionality be accessed using VBA? If so, any help or
direction would be appreciated. If not, can anyone think of a work
around?

Thank you,

Kelii
Aug 25 '08 #1
Share this Question
Share on Google+
4 Replies


P: n/a
My super easy merge does all 5 steps...and you can "enable" ANY screen for
merge with ONE line of code....

The sample I have can be found here:
http://www.members.shaw.ca/AlbertKal.../msaccess.html

What is nice/interesting about my sample is that is specially designed to
enable ANY form with ONE LINE of code....

Thus, each time you build a new form, you can word merge enable it with
great ease.

Make sure you read the instructions from above, and you should eventually
get to the follwoing page
http://www.members.shaw.ca/AlbertKal...rge/page2.html
Note that the merge can also use a query, and thus you don't have to merge
just "one" record..

After the merge occurs, you get a plain document WITHOUT any merge fields,
and this allows the end user to save, edit, or even email the document
(since the merge fields are gone after the merge occurs).

Give the above a try.

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Aug 25 '08 #2

P: n/a
Kelii <ke****@yahoo.comwrote:

Albert's code works very, very nicely.
>5. Word screen becomes visible for finalization
API: Find out if an application is currently running
http://www.mvps.org/access/api/api0007.htm

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Aug 26 '08 #3

P: n/a
Albert / Tony,

Thanks for the links, I'll give it a try and report back.

Best,

Kelii
Aug 26 '08 #4

P: n/a
Tony - I was able to copy and paste the code from Access Web right
into a module and use it as is.

I did read the code and I do have some understanding of the API calls
referenced in the module.

I am very grateful to both you and Albert for your suggestions, big
thank you :D

Albert - Thanks for the splendid suggestion, my issue was more around
getting the Access screen to become visible once the bookmarks were
populated, then toggle back to Windows once the Ok button was selected
in Access. In addition, the Word document I'm using is fixed, so the
user doesn't have to mess around with populating the Word document
with bookmarks.

Thanks again to you both,

Kelii
Aug 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.