makebarcode.com
 

 

   
 

Printing Code 39 Barcodes with Microsoft Access
Home > Barcode Basics >
Application Notes > AppNote014

Printing barcodes in Microsoft Access reports is relatively easy using a TrueType Code 39 barcode font. Code 39 is easy to implement because, unlike most other types of barcodes, it does not require calculation of a checksum so no function calls are required. Code 39 can be read by virtually every scanner anywhere in the world, and is useful for a wide variety of applications. The character set includes the upper case alphabet (A - Z), digits 0 - 9, and several commonly-used symbols.

Here is a link for more technical information about Code 39 (including a list of available characters): http://www.makebarcode.com/specs/code_39.html

The first step is to obtain a Code 39 TrueType font and install it on your system. Code 39 fonts are generally available in kits with a selection of height:width ratios, and with licensing for single computers, multiple computers, and for redistribution as part of a software package.

Add a text field to the Access report. If the report already has a defined data source, you can simply drag a field from the Field List and drop it on the report. You can also drop in a field using the Toolbox and then manually set the Control Source Property to a specific data field. As an example, if the source data field is PartNo, the Control Source Property will look like this:

    [PartNo]

If we select a Code 39 font and then print a sample copy of the report, we will get a barcode that looks something like this (PartNo = 12345):

cc39ttf1.jpg (3065 bytes)

This may look good, but it won't scan because it is missing the start and stop characters. These special characters are represented by an asterisk in most fonts. To add the asterisks automatically every time the PartNo field is printed, edit the Control Source Property, adding fixed asterisks before and after the data field. The result will look something like this:

    = "*" & [PartNo] & "*"

Now when the report is printed the barcode will be a little bit longer and it should scan correctly. Most fonts print an asterisk below the start/stop code, although some do not.

c39ttf2.jpg (3936 bytes)

If the barcode data contains characters which are not part of the Code 39 character set, blank spaces or rectangles will appear. For example, Code 39 does not include a symbol for the @ sign. Here is what happens if we try to print a barcode with the data string *123@456*

c39ttf3.jpg (4630 bytes)

Code 39 does include a space character, but it is normally represented by an underscore ( _ ) character. If you attempt to print a Code 39 barcode with an actual space character, Windows will simply insert a physical blank space. Here is a sample with a space character (*123 456*) which will not scan:

c39ttf4.jpg (4497 bytes)

Here is the same thing, but with an underscore in place of the space character (*123_456*). When the barcode is scanned the space character will be transmitted as a space, not as an underscore:

c39ttf5.jpg (4550 bytes)

Code 39 includes the upper case alphabet, but no lower case characters. Some fonts (including the ones referenced by the link above) automatically map lower case characters to upper case. For example, using a data string like *abCDefg* will automatically produce a barcode which contains *ABCDEFG*.


home
Contact:  info@makebarcode.com
(c) Copyright Measurement Equipment Corporation
All Rights Reserved