Opening a Word Merge and Selecting Its Data Source from Access

A

Amy E. Baggott

I have a form that runs data files for Word Merges that create cover letters
and floor plans (Word merges the data, and the actual floor plans are cut and
pasted from an interactive floor plan online) and then opens the Word Merge
documents. Currently I have each Word document hard-linked to a specific
file, and the code saves each query to its respective file. That works fine
if only one person is running the letters and floor plans. However, when we
are busy, we have multiple people doing the assigning of exhibitors, and each
is responsible for running the invoices, letters, and floor plans for the
exhibitors he or she has assigned. I can modify the queries to select only
the records for that user, but the problem is that if one user runs his/her
letters, then another user runs his/hers, the second one overwrites the data
from the first. I know I can have the form change the filename for the data
based on the user easily enough. What I want to know is whether there is a
way for the form to open the Word document and specify at runtime what the
data source for the merge should be? The command I am using to open the Word
file is:

Application.FollowHyperlink Forms!frmCurrentShow!txtExport & "Exhibitor
Correspondence and data\Correspondence\Exhibitor Confirmation Letter.doc"

Can anyone help me?
 
A

Amy E. Baggott

I still have a couple of questions:

1. Both of them look like they are creating new document templates. I am
working with three existing documents. Does this mean that I would have to
turn them into templates and put them on each user's machine?

2. Will these functions work in Word 2007, or will it get confused? (We
are using Access 2003 for the database, but Office 2007 for everything else.)

3. What happens if two different users run this function at the same time?
Will it treat the merge file as separate documents, or will it get scrambled?

This is something I've never tried before, and I want to make sure I have
all my ducks in a row before I tell my boss I can do this.
--
Amy E. Baggott

"I''''m going crazy and I''''m taking all of you with me!" -- Linda Grayson
 
A

Arvin Meyer [MVP]

Amy E. Baggott said:
I still have a couple of questions:

1. Both of them look like they are creating new document templates. I am
working with three existing documents. Does this mean that I would have
to
turn them into templates and put them on each user's machine?

This one: http://www.datastrat.com/Code/WordMerge.txt uses an existing
template. In fact, it uses Letter.dot which is located in the same folder as
the database, but it could be put anywhere and the code adjusted.
2. Will these functions work in Word 2007, or will it get confused? (We
are using Access 2003 for the database, but Office 2007 for everything
else.)

I would hope so. I'm not positive. Most of the code has been tested, but
that particular code has not. The best way to find out is to spend a short
time (maybe 20 minutes or so) to alter it to you application and test it.
3. What happens if two different users run this function at the same
time?
Will it treat the merge file as separate documents, or will it get
scrambled?

Remember, databases MUST ALWAYS be split in a multiuser environment. That
means the code is running from each workstation, and a copy of the template
should also be on each workstation.
This is something I've never tried before, and I want to make sure I have
all my ducks in a row before I tell my boss I can do this.

All I can say is that it's worth a try. If you run into a problem, post back
and I or someone else will be glad to help. I would suggest doing so within
the next few days though because Microsoft is changing their format for
helping, and it may make it difficult for us to connect.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.accessmvp.com
http://www.mvps.org/access
Co-author: "Access 2010 Solutions", published by Wiley
 

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