# Mail Merge - Next Record



## classiccocacola (Oct 20, 2011)

I am trying to create a document where all the records from a field need to be at the beginning of the document, and then I need to refer to each record in the field later in the document. A very simplistic example would be where I have three records in the NAME field. The way I have my document set up is to have NAME - <Next Record> NAME - <Next Record> NAME. (Which gives me the three names that I require at the beginning of my document). However, further down in the document I need a paragraph referring to each record in the NAME field. (ie. I need a paragraph about the first record in the NAME field, then I need a paragraph about the second record in the NAME field, and then I need a paragraph about the third record in the NAME field). However, because at the beginning of the document I utilized ‘next record’, the only information I can get for the following paragraphs relates to the last record. (Essentially, I need to find a way to populate the merge fields later in the document starting over from the first record). This also is an issue for every merge field I have in the document as the information merged into the document only relates to the last record. ie. if I had an ADDRESS field later in the document, the only address inserted into the document is the address from the last record (so I would only get the address for the 3rd name). Is there some way to force the mail merge to start populating the merge fields again from the first record after I have used ‘next record’ - or is there a way to set up the document so I can get the results for all the NAME records at the beginning of the document without using ‘next record’. The only way I can see right now to get around the issue is to get rid of the ‘next record’ field and merge the information into 3 separate documents, then manually combine the pertinent information from all 3 documents into 1 single documents (which isn’t really an option as this is just a simplistic example of my dilemma).


----------



## AlbertMC2 (Jul 15, 2010)

Hi

You can do this by creating a document like you have done with the 3 merge names in a row, separated by "next record"
Once that is done select each merge name individually and bookmark each one with a different name eg name1, name2 and name3.
Once that is done, further down your document you can create 3 fields (ref) and link each one to the bookmarks created above individually. 

Hope this makes sense.


----------



## classiccocacola (Oct 20, 2011)

Yes that does make sense (that sounds like how I have set up a couple of documents that use Ask/Fill-in as opposed to being set up as merge documents). I can see how bookmarking the name field and referencing it later in the document will solve the name merge field issue I have. 

The example I gave was a bit simplistic though with the problem I was experiencing in that later in the document I need to insert other information with respect to Name1, Name2, Name3 (ie. address or birth date). 

How do I get around the fact that by using 'next record' at the beginning of document, the merge is stuck on the last record so only brings back the address for the last record? How do I get it to insert the correct address for Name1 and Name2 - and then further in the document, the correct birth date for Name1 and Name2, etc. when it is stuck on the record containing information for Name3.


----------



## AlbertMC2 (Jul 15, 2010)

Hi

There are 2 ways to set this up.
1. 
You can setup everything on the 1st page. Setup the name/Details/"next record" then name/details/"next record" then name/details/"next record" on the 1st page (It doesn't matter about the layout as long as the details of one person follow one another before the "next record". 
Bookmark each item (name1/address1/dob1 and name2/address2/dob2 etc)
Then on the 2nd page setup the actual document and use fields (ref) to refer back to the previous page's bookmarks. 
If you want to print the document then print every 2nd page.
If you are using Word 2007/2010 you can even hide the "detail" pages - I don't know if you can do this in Word 2003.

2.
The 2nd option you can create everything on one page however it does get cluttered and the spacing might not work properly.
You can create the document as you have done in your previous posts.
But you can insert an *IF* merge field between your (EG) name merge field and "next record".
So lets say you have *3 names* which have a *date of birth (DOB)* field.
At the top of the document insert the name <<name>>
Then insert the IF..THEN..ELSE field and compare it to something it will never be eg. 
*IF *
Field Name: *DOB *
Comparison: *equal to *
Compare to: *ZZZZ*
Inset this text: *""*
Otherwise insert this text: *""*

What this will do is compare the DOB to "ZZZZ" (which it will never be), If it is equal it will print nothing and if it is not equal it will print nothing.
Once you have done this you will have to toggle the field codes (press ctrl-a, then right click on the selected text and click "toggle field codes")
You can now see the underlying field codes.
The If..THEN..ELSE code will look something like
*{IF {MERGEFIELD dob}=0 """" """"}*
When you see this select the *{MERGEFIELD dob}* part and create a bookmark eg DOB1
You can now refer to the DOB1 bookmark later in the document.
After the IF..THEN..ELSE statement you can now insert the next detail in the same way after which you can insert the "Next Record"
So in the end you will have something like:

```
<<name>>{IF for <<DOB>>}{IF for <<ADDRESS>>}{IF...}<<Next record>><<name>>{IF for ...}

<<name>>
<<ref DOB1>>
<<ref address1>>

<name>>
<<ref DOB2>>
<<ref address2>>
.
. etc
```
Note that the problem with this way is that each IF..THEN..ELSE statement seems to cause a space to appear where the IF statement lies.


----------



## classiccocacola (Oct 20, 2011)

Method 1 will definitely solve my problem. Thanks for the help!


----------

