Imbedded MERGEFIELD in IF/ELSE/THEN field

R

Rich

Via MS-Word 2000, I'm trying to create a mail-merge address label template
which will print the country name for a non-USA address, or will print the
Postnet Barcode for the ZipCode for a USA address.

I've attempted to create an IF/ELSE/THEN field as follows:

{ IF {MERGEFIELD country } = "USA" "{ BARCODE { MERGEFIELD zipcode} \U }" "{
MERGEFIELD country }"}

When I merge the data, it performs the IF test properly, and also properly
prints the country name for the non-USA entries. However, I can't seem to
get the USA portion of the IF test to work properly -- rather than printing
the barcode for the associated zipcode, it just leaves it blank.

Is this sort of nesting/imbedding not capable?
 
P

Peter Jamieson

The basic problem is that BARCODE fields do not work when they are nested
inside IF fields.

Before continuing, it's worth saying a few other things about BARCODE
fields:
a. they only work if you have selected USA as your country code in COntrol
Panel|Regional Settings
b. I am not in the US and do not use them, but I am told that the Microsoft
Word BARCODE field no longer generates USPS barcodes correctly (i.e. the
rules have changed). My understanding was also that you have to have a
street address in the data used to generate the barcode. There are articles
in the Microsoft Knowledgebase about this (go to
http://support.microsoft.com and search for Word, BARCODE, USPS etc.)
For example, you might need to use something like

{ BARCODE \u "{ MERGEFIELD street }
{ MERGEFIELD zipcode }" }

to generate your code, rather than just

{ BARCODE \u "{ MERGEFIELD zipcode }" }

In other words, you need to verify that your BARCODE field, however you
produce it, is producing a valid bar code.

To avoid using an IF field, you can try the following:

Create another Word document and copy/paste your BARCODE field in
there. Select it, and insert a bookmark called USA. Then put the insertion
point somewhere outside the field and ensure it's a point selection (i.e.no
text is selected) and insert a bookmark called NONUSA.Save the document
(let's say it is called c:\barcode\barcode.doc) and put the following fields
in your merge main document:

{ IF { MERGEFIELD Country } = "USA"
"{ SET barcodecountry USA }"
"{ SET barcodecountry NONUSA }"
}{ INCLUDETEXT "c:\\barcode\\barcode.doc" { REF barcodecountry } }

(Or if for example your data source has USA for the USA ones and NONUSA for
the others, you can avoid the IF and just try

{ INCLUDETEXT "c:\\barcode\\barcode.doc" { MERGEFIELD Country } }
)

Peter Jamieson
 
R

Rich

b. I am not in the US and do not use them, but I am told that the Microsoft
Word BARCODE field no longer generates USPS barcodes correctly (i.e. the
rules have changed).

Wow, if that turns out to be true, I'm gonna be *really* irritated for
having wasted so much time on this project. said:
There are articles in the Microsoft Knowledgebase about this (go to
http://support.microsoft.com and search for Word, BARCODE, USPS etc.)

Thanks, I'll go see what I can find out.

-Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top