In a document you can print any data / variables / data fields / bookmarks / etc. as bar codes.
See Printing bar codes in Microsoft Word documents for step-by-step instructions.
Our product provides the bar code functions you need to print bar codes, but you must format your data, as you require, before it is printed as bar codes.
Here is some helpful advice about how to format different field types, before you use the result as the argument to a bar code function.
Text fields usually do not require any special formatting. To print field ORDER_NUMBER as a Code 128 bar code we use function CIA_CODE128, like so;
|A$ = CIA_CODE128 ( ORDER_NUMBER )|
Note: If your variable / field / data object has the same name as any Microsoft Word reserved word (e.g. 'Name', 'Null') you must qualify the name in the calculated field;
|A$ = CIA_CODE128 ( MyDoc.Name )|
One typical application requirement is to print bar codes containing more than one field. If ORDER_NUMBER and BATCH_NUMBER are both text fields (or variables), you can use simple string concatenation, like so;
|A$ = CIA_CODE128 ( ORDER_NUMBER + "," + BATCH_NUMBER )|
to print a Code 128 bar code containing two fields, separated by a comma.
Use the Visual Basic Format( ) function to print numbers in different number formats.
In Microsoft Word Help, see Format function under Visual Basic Language Reference.
For example, to print a numeric value with up to 5 leading zeros and no decimal places;
Format ( Field, "00000" )
When you use a bar code function, this will produce numeric bar codes of equal length;
|A$ = CIA_CODE128 ( Format ( Field, "00000" ) )|
Use Format( ) to print dates in different date formats. For example, to print dates without the date separator;
Format ( Field, "YYYYMMDD")
When you use a bar code function, this will reduce the size of date bar codes and also allows you to use bar code types that only allow numeric characters;
|A$ = CIA_CODE128 ( Format ( Field, "YYYYMMDD" ) )|
The standard Visual Basic function IIF( ), is very useful for printing Yes/No fields as any two values. For example, you can use IIF( ) to print a field as Y or N instead of Yes and No, using the following as the Data Source expression;
IIf( [Field]=0, "N", "Y" )
When you use a bar code function, this will produce small bar codes of equal length, containing Y or N;
|A$ = CIA_CODE128 ( IIf ( Field = 0, "N", "Y" ) )|
If you need other examples, see Technical Support.
Copyright © 2000 CIA (BAR CODES) UK. All rights reserved. Reproduction prohibited.