Font-based Barcode Printing in Access

On this page we show how to use StrokeScribe COM Class to draw barcodes in Access with specialized TrueType fonts.

Requirements

How to Prepare a Report

1. Insert a Text Box into your report.

Adding a text box into a report in Access

2. Right-click the text box, select Properties from the context menu.

3. Switch to the Format tab on the property sheet.

4. Set the Font Name property to "StrokeScribe 2D".

5. Set the Font Size to any value in the range of 1..6:

Applying the 2D barcode font to a text field in Access

6. Switch to the Data tab. Modify the Control Source property as shown on the picture.

Replace the [f2] with a desired field name - it will be the data source for the barcode generator:

Setting up the data source for barcode generator

7. Open the VBA window (Alt-F11).

8. Create a VBA module:

Adding a VBA module in Access

9. Paste the code into the module:

Function barcode(s As String) As String Dim bar As StrokeScribeClass Set bar = CreateObject("STROKESCRIBE.StrokeScribeClass.1") bar.Alphabet = QRCODE bar.Text = s barcode = bar.FontOut If bar.Error <> 0 Then Debug.Print bar.ErrorDescription End If End Function

10. Add a reference to the StrokeScribe Class into the VBA project.

Related Tutorials