Word, Next Record If Rule (Mail Merge)

In this article I will explain the Next Record If Rule. Previously in the article below I’ve explained about the Next Record Rule:

It is assumed readers are familiar with Next Record Rule before reading this article.


What is it?

The Next If Record Rule checks a certain field of the current record with a value. If the comparison returns true, all proceeding fields will skip a record. If the comparison returns false, the Next Record If Rule will be ignored.

Example:
Consider the document below.

Note: Alt + F9 was pressed to display all the fields in their code format:
Example
The document consists of the following fields:

  1. A greeting line
  2. A Next If Rule
  3. Another greeting line

The Next If Rule compares the Title of the current record with the value “Ms”. If the title is equal to “Ms” then all proceeding greeting lines will skip a record. If the title of the current record is not “Ms” then the Next If Rule will be ignored:
Next If Record

In the figure below you can see the List of Recipients used in this example:
Recipient List
As you can see the first record is for “Mr John” therefore the Next Record If Rule is ignored. As you can see from the figure below both greeting lines are being displayed for “Mr John”:
Ignored Next Record Rule
The next record is for “Ms Ellon” , therefore all proceeding fields will skip a record. As you can see although the first greeting line is for “Ms Ellon” but the next greeting line skips a record and displays the greeting line for “Mr Phil”:
Skipped Record


How to?

Step 1:
Create the main layout for your document. Create a Recipient List. And Insert any Fields the document may need:

Step 2:
Move the cursor to the location you want the Next Record If Field to be inserted.

Note: All proceeding records will display data from the next record if the comparison in the Next If Record Rule returns true.
Cursor Location
Step 3:
Click on the Rules button on the Mailings Ribbon. Select the Next Record If Field:
Next Record If
In the window that opens there are 3 parts:
Next Record If Rule
Field Name:
You will be able to choose the field thats its value will be compared. Note these fields were defined when you were creating the Recipient List:
Field Name
Comparison:
This is the method that will be used to compare the field:
Comarison
Compare to:
This is the value that will be compared with the field value. As can be seen from the figure below, the title of the recipient will be compared to the value “Ms” to see if they’re equal or not:
Compare to
Note: The Next Record Field is not visible unless you press Alt + F9:
Alt+f9

You can download the sample file used in this article from the link below:

See also:

If you need assistance with your code, or you are looking for a VBA programmer to hire feel free to contact me. Also please visit my website  www.software-solutions-online.com

Leave a Reply

Your email address will not be published. Required fields are marked *