Nesting the BARCODE field within an IF field.

T

Tom

Nesting the BARCODE field within an IF field.

MS Word 2000 using an MS Access 2000 database query in a
mail merge setup. I have an address listing which
contains both US and foreign addresses. My objective is
to place US Barcode on the bottom of the label if the
address has a country value of 'USA'. Here is the field
codes I am using:

{ IF { MERGEFIELD Count } <> "USA
{MERGEFIELD Count}
{BARCODE "{ MERGEFIELD Zip}" \u \* MERGEFORMAT}
}

The second condition here will not work. If the address
is foreign then the Country field is displayed; that works
fine. But if the country field is 'USA' then the barcode
will not display/print. If I move the exact field codes
for the BARCODE field out of the IF field then it will
work. I can replace the BARCODE line with another field
like page number and this will work. For some reason I am
not able to use a BARCODE within an IF field. Can anyone
tell me why and how to fix/workaround?

Thanks!
 
P

Peter Jamieson

I think you wil always get a null result if you try to nest the BARCODE
inside an IF, and this is probably one of those cases where you need an IF
inside an INCLUDETEXT, e.g.

Create a document with

{ BARCODE "{ MERGEFIELD Zip }" \u \* MERGEFORMAT }

and

{ MERGEFIELD Count }

bookmark the BARCODE field using the name USA and the Mergefield Count field
using nonUSA.

Save the document, e.g. as c:\mybc\barcode.doc

Then use the nested field

{ INCLUDETEXT "c:\\mybc\\barcode.doc" "{ IF { MERGEFIELD Count } = "USA"
"USA" "nonUSA" }" }
 

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