This reply to an existing thread in microsoft.public.access cross-posted to
microsoft.public.word.mailmerge.fields. For those people in the
mailmerge.fields group, who are seeing only this portion, the original thread
can be found here:
http://www.microsoft.com/office/com...cess&mid=14608472-6cff-4b65-a454-57b8de2b8f8d
====================================
Hi Renee,
I've spent hours trying, but so far I have not had any luck getting this to
work correctly. I posted a request for help from other MVPs in Word and
Access, and got three responses from Word MVPs. I've tried all of these
responses, but still no joy. Here are the responses that I received:
=================================
<First respondent>
In this case, from what the OP posted, I would say that she has probably
typed the {} around the INCLUDEPICTURE field, rather than using the special
field braces you can insert using ctrl-F9.
However, you also have to:
a. either double up all the backslashes in the path name, or use forward
slashes
b. uncheck Word Tools->Options->General->Web options->Files->Update links
on save - otherwise, when you save the mail merge main document, the
included field is unlinked, leaving a URL-style path with %20s instead of
spaces, and so on.
c. select the output document and refresh all the INCLUDEPICTURE fields
using F9. (You may find printing directly works, or you may have to set
either or both of Word Tools->Options->Print->Update fields and Update
links.
My experience is that it is also very easy to insert a space that should not
be there at the beginning of the file path name, e.g. using
{ INCLUDEPICTURE " { MERGEFIELD myfield }" }
=================================
<Second respondent>
I'm no expert with this stuff but the double backslashes are critical. AFAIK
you can't do it in the merge itself (although you could probably manage it
in a MailMergeAfterRecordMerge (or maybe MailMergeAfterMerge) Application
event) and it would be better if you had a query in your database containing
them, on which you could base the merge - unfortunately, again, I don't
think this is as easy as it might be. You really need to use the VBA
Replace(Photo,"\","\\") function but it doesn't exist as an Access function
so you will need to build your own (rather trivial) VBA function and use
that in your query.
=================================
<Third respondent>
What I find works best is to use Insert | Picture | From File: Link to File
to insert a "known-good" path in the IncludePicture field, then base my
merge syntax on that. Also, if all the pictures are in a single folder, you
can type the entire path except for the actual image filename as part of the
field, putting just the image filename in the merge field.
=================================
Here are my comments back to each person who provided help:
To the first respondent:
Thank You very much for your input. On the issue of typing the {},
that's exactly what I was attempting to do. At the time, I was kind of
wondering about this, thinking it might be more like an array formula in
Excel, but since Cindy didn't mention it on her web page...
To the second respondent:
Thank You Tony for your input. Actually, Access does have the Replace
function available. I believe it was added in Access 2000. Prior to
that, folks would code their own replace function, but I imagine that
likely wouldn't work since the mail merge functionality is not running
msaccess.exe to actually run such a function. One can call this function
directly from a query, but only if Sandbox mode is not enabled for
Access.
++++++++
However, since writing the above comment back to the second person, I have
since discovered that Word Mail Merge does not want to display a SELECT query
if it contains a reference to a built-in function, such as the Replace
function. So, I ended up manually editing the paths in my database to include
the double slashes separating the folders. Still no joy.
Perhaps it would be a lot easier to just use Access as your report writer!
Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________