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.
Consider the document below.
Note: Alt + F9 was pressed to display all the fields in their code format:
The document consists of the following fields:
- A greeting line
- A Next If Rule
- 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:
In the figure below you can see the List of Recipients used in this example:
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”:
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”:
Create the main layout for your document. Create a Recipient List. And Insert any Fields the document may need:
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.
Click on the Rules button on the Mailings Ribbon. Select the Next Record If Field:
In the window that opens there are 3 parts:
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:
This is the method that will be used to compare the field:
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:
Note: The Next Record Field is not visible unless you press Alt + F9:
You can download the sample file used in this article from the link below:
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