
Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
I have a number of Y/N fields in Access that will determine whether certain
paragraphs are required in a letter.
For example, If fldDeposit = true then I need to include in the merged
document, the paragraph in the boilerplate document that I have labelled
with a bookmark of say 'Deposit'. If it is not true, then the alternative
will simply be blank. There would be another one with a paragraph on
Privacy that would be included in a similar way and another two fields, all
working in a similar way..
I am familiar with the if.. then.. else.. method in a merge document, but
according to what I read, the INCLUDETEXT looks like { INCLUDETEXT
"C:\\DocInfo\\Boiler.doc" { MERGEFIELD CUSTTYPE } } where mergefield
CUSTTYPE holds the name of the bookmark (I got this from Cindy Meister's
excellent website).
What I can't work out is how to get the field that contains the name of the
bookmark to merge when I am sending the fields out from Access. Do I have
to send it from access, or can I just have it worded into the mailmerge
document so that it acts on the value of the Y/N field. I hope that makes
some sense at least.
dixie
> A better question would be how do *you* determine which paragraph(s) to use?
> Without knowing the criteria it is difficult to suggest a method.
[quoted text clipped - 23 lines]
> >
> > dixie
Cindy M -WordMVP- - 25 Aug 2004 10:33 GMT
Hi Dixie,
You're very close. One thing you do need, given how this is constructed, is a
bookmark that holds "nothing" (or a single space). The IncludeText field will
want to pull *something* in, or you get an error, so you need to specify the
empty alternative.
The IncludeText field should then look something like this:
{ INCLUDETEXT
"C:\\DocInfo\\Boiler.doc" { IF { MERGEFIELD CUSTTYPE } <> 0 "BookmarkName"
"AlternateBookmarkName" } }
One important thing you haven't mentioned is the version of Word you're doing
this in. Word 2002/2003 with an OLE DB connection pass Yes/No instead of -1/0
(0 = false = no being the key for the IF test). So, if you test a combination
like the above and always get the "true" result, put the { MERGEFIELD
CUSTTYPE } directly into the document and see if the result is literal Yes or
No text, or -1/0 (or possibly 1/0) combination.
> I have a number of Y/N fields in Access that will determine whether certain
> paragraphs are required in a letter.
[quoted text clipped - 17 lines]
> document so that it acts on the value of the Y/N field. I hope that makes
> some sense at least.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
Graham Mayor - 25 Aug 2004 11:46 GMT
Or you could probably do it the other way round eg
{IF {Mergefield fldDeposit} = "Y" "{IncludeText "C:\\DocInfo\\Boiler.doc"
Deposit}"}

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Cindy M -WordMVP- wrote:
> Hi Dixie,
>
[quoted text clipped - 46 lines]
> This reply is posted in the Newsgroup; please post any follow
> question or reply in the newsgroup and not by e-mail :-)
Cindy M -WordMVP- - 25 Aug 2004 17:44 GMT
Hi Graham,
> Or you could probably do it the other way round eg
> {IF {Mergefield fldDeposit} = "Y" "{IncludeText "C:\\DocInfo\\Boiler.doc"
> Deposit}"}
Sometimes. But not always. In Word 95/6 and earlier it definitely did not
work, because Word was designed to update field codes from the innermost
layer, outwards. Because so many people wanted to do "forbidden"
combinations, with the IF field in the outermost layer (it is more
intuitive, after all), Microsoft did something to the way the fields update
so that later version can work this way. But it doesn't always work, which
is why I usually recommend the other way...
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org
This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)
Graham Mayor - 25 Aug 2004 18:16 GMT
It should work in recent versions, but I take your point, which is why I
added 'probably' ;)

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Cindy M -WordMVP- wrote:
> Hi Graham,
>
[quoted text clipped - 17 lines]
> This reply is posted in the Newsgroup; please post any follow
> question or reply in the newsgroup and not by e-mail :-)