Microsoft KB Archive/212178

= WD: Cannot Merge a Barcode Field Based on a Condition =

Article ID: 212178

Article Last Modified on 7/27/2006

-

APPLIES TO


 * Microsoft Word 2002 Standard Edition
 * Microsoft Word 2000 Standard Edition

-



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}

{MERGEFIELD Name}

[{MERGEFIELD Address}

{MERGEFIELD City}{MERGEFIELD State}{MERGEFIELD Zip}] "The Zip Code Does Not Match"}

NOTE: "" 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.

Additional query words: usa bar code WD2002 WD2000

Keywords: kbnofix kbmerge kbprb kbfield KB212178

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.