Using Format( ) function to format bar code data

The Visual Basic Format( ) function is a very powerful and flexible way to format values; text, number, date, etc. It can be used in a; report, form or query.

Format(value, format_text)

The formatted result of the Format( ) function can be used with bar code functions, to automatically print bar codes containing exactly the characters you need.

Tip: Before you use bar code functions, use the Format( ) function to format results as text in a report or query, and when you get the formatting you want, then use the results in your bar code formulas.

Leading zeros

Tip: If we use leading zeros, to produce fixed length data, any resulting bar codes will all be the same length.

This formula prints values in [MyNumberField], formatted with up to 5 leading zeros and no decimal places;

  =Format([MyNumberField], "00000")

If [MyNumberField] contains 12 the result is 00012. We can use the result with a bar code function;

  =CIA_CODE128(Format([MyNumberField], "00000"))

to produce a Code 128 bar code containg 00012.


  =Format([MyDateField], "YYYYMMDD")

If the date contains 07/04/01, the result would be 20010704, which allows numeric only bar code types to be used (e.g. Interleaved 2 of 5);

  =CIA_ITF(Format([MyDateField], "YYYYMMDD"))

this also produces smaller printed bar codes.


Copyright 2000 CIA (BAR CODES) UK. All rights reserved. Reproduction prohibited.