WD: Cannot Merge a Barcode Field Based on a Condition (212178)



The information in this article applies to:

  • Microsoft Word 2002
  • Microsoft Word 2000

This article was previously published under Q212178

SYMPTOMS

A BARCODE field nested in an IF field produces no merge result even when the condition is true.

For example, if you use an IF statement similar to the following, the BARCODE field is not created and no error message appears:

{IF {MERGEFIELD Zip} = "98052-6399" "{BARCODE Address \b \* MERGEFORMAT}<P>
{MERGEFIELD Name}<P>
[{MERGEFIELD Address}<P>
{MERGEFIELD City}{MERGEFIELD State}{MERGEFIELD Zip}] "The Zip Code Does Not Match"}

NOTE: "<P>" indicates pressing ENTER and "[" and "]" indicate the Address bookmark. To show bookmarks in your Word document, click Options on the Tools menu and then on the View tab, select the Bookmarks check box.

CAUSE

BARCODE fields are a special type of Word field called a "display" field. Display fields produce their own results and, unlike other Word fields, the result of a display field cannot exist independently of the field itself (display fields cannot be unlinked). Consequently, the result of a display field cannot be fetched by the IF field for its result.

WORKAROUND

To work around this problem, use either of the following methods.

Method 1

Use the Record Selection feature to merge only those records that you want to contain the postal bar code. After all those records have been merged, remove the BARCODE field and merge the remaining records.

For more information about how to select certain records from your data source, click Microsoft Word Help on the Help menu, type record selection in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

Method 2

Sort the data file by the country field so that all records for the U.S. are together. Using the Mail Merge Helper, merge only the range of records that includes the country U.S. After all U.S. records have been merged, remove the BARCODE field and merge the range of records that includes countries other than the U.S.

For more information about how to sort the records in your data source, click Microsoft Word Help on the Help menu, type sort records in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

Modification Type:MinorLast Reviewed:7/27/2006
Keywords:kbfield kbmerge kbnofix kbprb KB212178