View Single Post
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
JAnderson JAnderson is offline
external usenet poster
 
Posts: 21
Default Mergefields, IF statements and section breaks

Ok, this is a somewhat complicated one, so bear with me:

I have a large document where each page is an "IF" statement followed by a
next-page section break. Let's pretend that I'm using the merge field
"Animal" as my condition:

{IF{MERGEFIELD_ANIMAL}= "BEAR" "
Document relating to bears
More text, formatting of 0.5" margins
More text
---section break (next page)---
" ""}
{IF{MERGEFIELD_ANIMAL}= "ZEBRA" "
Document relating to zebras
More text, formatting of 1" margins
More text
---section break (next page)---
" ""}
BEGIN REGULAR 2-PAGE DOCUMENT
More text, 1.2" margins
More text
End of document

Thus, if the condition "Bear" is met, then a document relating to bears will
become part of my document, otherwise, nothing happens (the false condition
is ""). Likewise, if "Zebra" is the value of the field, then a document
about zebras appears. Under any condition, however, my "regular" document is
always part of the merge (say, a fact sheet about zoo animals).

This method, while potentially inelegant, works for our specific needs, and
works without any problems. However, there becomes a point where inserting
one more "IF" statement will "break" the whole document.

Say I realize that I need to add yet another document about Lions, so I
follow the formatting above and enter this Lion IF statement right after the
zebra IF statement. For some reason, headers, footers and margins (section
break qualities) will not be correct for whatever document I merge, and
sometimes the "next page" section breaks will reorient themselves as
"continuous", thus melding pages together.

I'm a bit stuck at this point, because I can't understand why, if a section
break is within an IF statement, it would later become functional even though
its condition is not met. Would it be more effective if, every time I added
a new IF statement, I re-built the whole document starting with "Bear", then
"Zebra", then "Lion", then "Regular document"? Is this just a lost cause?

(The reason I am insistent on doing it this way is because, on a grander
scale, I do not want to have hundreds of individual documents to use for
merging data; I would prefer to have one 'master' document.)

Thanks in advance,