Using VBA to toggle from MS Word to MS Access?

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

Thank you,

keliie (60)
8/25/2008 3:23:26 PM
comp.databases.ms-access 42670 articles. 0 followers. Post Follow

4 Replies

Similar Articles

[PageSpeed] 21

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:

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

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

8/25/2008 4:39:37 PM
Kelii <keliie@yahoo.com> wrote:

Albert's code works very, very nicely.

>5. Word screen becomes visible for finalization

API: Find out if an application is currently running

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 
   Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
ttoews (2789)
8/26/2008 12:52:19 AM
Albert / Tony,

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


keliie (60)
8/26/2008 3:03:05 PM
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,

keliie (60)
8/27/2008 1:16:22 AM