Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / August 2004

Tip: Looking for answers? Try searching our database.

Barcode field inside "IF" Statement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
LDanix - 19 Aug 2004 00:59 GMT
I am using Word and Excel to merge form letters and envelopes. The addresses
that I use go to the US and outside the US. I want Word to print the barcode
for US address and not generate an error message for non-US addresses. For
the life of me, I cannot figure out what is wrong with my syntax. I created a
column in Excel specifically to help the merge differentiate between what
needs a barcode and what does not. Here is my syntax for the field:

{ IF "{MERGEFIELD Country}" = "USA" "{BARCODE "{MERGEFIELD Street_Address}
{MERGEFIELD City_State_ZIP}"\*MERGEFORMAT}" ""}
Doug Robbins - 19 Aug 2004 02:31 GMT
I think that to get the barcode to display, the arguement for the Barcode
field should be

{ BARCODE \u {MERGEFIELD ZIP}}

Signature

Please respond to the Newsgroup for the benefit of others who may be
interested.   Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP

>I am using Word and Excel to merge form letters and envelopes. The
>addresses
[quoted text clipped - 8 lines]
> { IF "{MERGEFIELD Country}" = "USA" "{BARCODE "{MERGEFIELD Street_Address}
> {MERGEFIELD City_State_ZIP}"\*MERGEFORMAT}" ""}
Graham Mayor - 19 Aug 2004 07:16 GMT
Most of the correspondents in this newsgroup live outside the US, and thus
do not use barcodes; however fellow contributor Peter Jamieson wrote the
following a while back. The first sentence may provide a clue!:

"Ensure that your locale is set to U.S. English in Regional options,
otherwise the barcode field will not work whatever you do. (If you are in
the U.S. this would typically be the default setting).

US POSTNET barcodes are constructed from two pieces of information which you
will need in your data source:
a. a number in a street address
b. a 9-digit ZIP code

The BARCODE field requires that the 9-digit ZIP is in 5-4 format (with the
hyphen).

In your label you typically need a BARCODE field that looks like:

{ BARCODE "{ MERGEFIELD "street address" }?
{ MERGEFIELD Postcodefield }" \u }

(The ? is just a normal paragraph mark that you will see if you press Enter
after { MERGEFIELD "street address" }
and click the ? symbol in Word's toolbar).

However, the last 2 digits of the BARCODE may not be generated from a Street
address in all
cases, so you may need to do something more than just { MERGEFIELD "street
address" }. You may find the following articles useful:

WD2000: How to Read Postal Bar Codes
http://support.microsoft.com/default.aspx?scid=kb;en-us;214181

and the article referenced in there:

WD2000: USPS Changes Postal Bar Code Requirements for Multi-Unit Buildings
http://support.microsoft.com/default.aspx?scid=kb;EN-US;220548

NB, The barcode field inserted by the Envelopes/Labels option uses a
slightly different approach which is to bookmark the whole address and use

{ BARCODE bookmarkname \b \u }

I would have also have a look at:

WD97: Word Assigns a Delivery Point Bar Code (DPBC) of 99:
http://support.microsoft.com/default.aspx?scid=kb;en-us;197008"

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> I am using Word and Excel to merge form letters and envelopes. The
> addresses that I use go to the US and outside the US. I want Word to
[quoted text clipped - 6 lines]
> { IF "{MERGEFIELD Country}" = "USA" "{BARCODE "{MERGEFIELD
> Street_Address} {MERGEFIELD City_State_ZIP}"\*MERGEFORMAT}" ""}
LDanix - 19 Aug 2004 13:13 GMT
If I take the barcode field out of the IF statement, and place it by itself,
it will generate a bar code just like it should. So, I know that all my
settings for the barcode to work are correct. If I remove the barcode field
and replace it with a couple words, in the IF statement, the IF statement
works as normal. I'm wondering if Word does not allow a barcode field to be
placed inside an IF statement, and if it is possible, what is the correct
syntax to get it to deliver the expected results.

> Most of the correspondents in this newsgroup live outside the US, and thus
> do not use barcodes; however fellow contributor Peter Jamieson wrote the
[quoted text clipped - 54 lines]
> > { IF "{MERGEFIELD Country}" = "USA" "{BARCODE "{MERGEFIELD
> > Street_Address} {MERGEFIELD City_State_ZIP}"\*MERGEFORMAT}" ""}
Graham Mayor - 19 Aug 2004 13:58 GMT
I cannot see any mechanism that should prevent it from working, however it
may simply not be updating. Merge to a new document, select the lot (CTRL+A)
then press F9 to update. Does that improve things?

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> If I take the barcode field out of the IF statement, and place it by
> itself, it will generate a bar code just like it should. So, I know
[quoted text clipped - 74 lines]
>>> { IF "{MERGEFIELD Country}" = "USA" "{BARCODE "{MERGEFIELD
>>> Street_Address} {MERGEFIELD City_State_ZIP}"\*MERGEFORMAT}" ""}
Peter Jamieson - 19 Aug 2004 17:19 GMT
I see this problem in Word 2000, which is what is in front of me. Not sure
about other versions.

I suspect you may have to do something along the following lines:

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 fieldand ensure it's a point selection (i.e.no
text isselected) and insert a bookmark called NONUSA.Save the document
(let's say it is called c:\barcode\barcode.doc) andput the following fields
in your mergemain 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 } }
)
Signature

Peter Jamieson

> If I take the barcode field out of the IF statement, and place it by itself,
> it will generate a bar code just like it should. So, I know that all my
[quoted text clipped - 26 lines]
> >
> > (The ? is just a normal paragraph mark that you will see if you press
Enter
> > after { MERGEFIELD "street address" }
> > and click the ? symbol in Word's toolbar).
[quoted text clipped - 32 lines]
> > > { IF "{MERGEFIELD Country}" = "USA" "{BARCODE "{MERGEFIELD
> > > Street_Address} {MERGEFIELD City_State_ZIP}"\*MERGEFORMAT}" ""}
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.