Native Barcode Generator for Microsoft Access

2022 Product Update: QR Code now includes new built-in support for UTF8 EncodingTLV and Base64Swiss QR-BillCenter Override, and GS1 QR Code. Data Matrix includes a faster and more efficient auto-encoding algorithm and supports GS1 and UTF8.

Buy License Support Download Demo Release Log

Product Overview and Compatibility


The Native Barcode Generator is intended for Microsoft Access Developers that wish to easily integrate barcode capability into their databases and applications without any external dependencies. This product is implemented as a VBA Module.BAS file with complete source code, which allows the developer greater flexibility in implementation and design without any annoying add-in menus or license file requirements. Once installed in a database, no other components or fonts need to be installed to create barcodes; it is the complete barcode generator that stays with the database, even when distributed. 

Compatibility and Requirements
Application Compatibility Access 2000 and greater including Access 2016.
OS Compatibility Compatible with both 32 and 64-bit systems, including Microsoft® Windows® 7, 8, and 10.
Barcode Symbology Compatibility Code 128, Code 39, Code 93, Codabar, GS1-128, Interleaved 2 of 5, MSI, USPS Intelligent Mail (IMb), OneCode Confirm, Postnet, PDF417, QR-Code, GS1 QR-Code, AIM QR-Code, Micro QR-Code, GS1-DataMatrix, DataMatrix ECC200, DataBar Omnidirectional, DataBar Stacked Omnidirectional, DataBar Expanded & DataBar Expanded Stacked. *
  • Versions 2021 and greater support UTF-8 Unicode for Data Matrix, PDF417, and QR Code in binary or byte mode. This includes compatibility with Arabic, Chinese, and Kanji characters.
  • The Data Matrix symbology in this product version 2021 and greater contains an improved algorithm that is 4 times faster than previous versions and can encode data more efficiently into a smaller symbol.
  • QR Code in version 2022 and greater supports the Swiss QR-Bill with Center OverrideGS1 QR Code, and TLV (Tag-Length-Value) encoding in Base64.
Intended Implementer Access Developers; End users and non-developers may wish to use the IDAutomation Barcode ActiveX Controls.

* This package does not support UPCA, UPCE, EAN13, or EAN8 barcodes because of the required OCR text characters that must appear below this barcode type. If these barcode symbologies are required, the UPC/EAN Barcode Font Advantage Package is available as a separate purchase. In addition, GS1 DataBar can encode all UPC and EAN barcode types within a smaller symbol and has been approved for use in POS systems since 2010.

Tutorial

Report Barcode Integration

Installing the Access Native Barcode Generator is a simple process. If problems are encountered with this tutorial, IDAutomation recommends referring to the sample database included in the package. The demo version of this product may only be used within the sample database provided in the download.

  1. Extract the files from the Access Native Barcode Generator package.
  2. Open the database where the barcode is needed.
  3. Press ALT-F11 to open the Visual Basic Editor. If ALT-F11 does not work, in Access 2000 or 2003 choose Tools - Macro - Visual Basic Editor. For Access 2007 and above, choose Database Tools - Visual Basic.
  4. From the Visual Basic Editor, choose File - Import File and import the appropriate VBA module from the files extracted.
    Embedding the Barcode VBA Module
    Once the files are imported, they become embedded in the database file.
  5. Choose File - Save and then close the Visual Basic Editor. All functions of the Access Native Barcode Generator are now embedded in the database.
  6. Change the report in Design View. This is accomplished by right-clicking on the report and choosing Design in versions prior to 2007 Access. In versions of Access 2007 and above, go to the Design tab and change the view to Design View.
    Change to Design View
  7. Insert a text box in the details section of the form, and increase the height and width so it will be able to contain the barcode. The text box may be easily added by dragging the field from the Field List in versions of Access prior to 2007. Size the box so it is tall and wide enough to contain the barcode symbol. The height of the barcode is changed by sizing the text box.
    Sizing the text box for the bar code
    In versions of Access 2007 and above, click on the text box icon in the Controls Section on the Design Ribbon.
    Choose TextBox from Controls
    Draw the text box on the details section of the form large enough to contain the barcode symbol.
    Draw text box
    A label on the left side of the text field will be automatically added, as shown in the image above with the Text20 label, but may be removed because it will not be visible when the report runs.
  8. Right-click on the text box and select Properties. Change the Name of the text box to txtIDAutomationBC1 and verify the control source is the field that needs to be encoded in the barcode.
    Change the name of the text box
    Optional: The Control Source may be changed to a formula that appends text to the data or combines multiple fields, for example: ="PREFIX" & [Field1]  or  =[Field1] & [Field2]  or  =[Field1] & "," & [Field2]
  9. Save and run the report. Verify that the data to be encoded in the barcode appears in the text box. If it does not, consult Access Help to determine how to get the correct data in the text box. The result of the Control Source in the text box is what will be encoded in the barcode. In some instances, it may be necessary to specify the table and field in the control source, for example: =([Table1.Field1])
  10. If it is desired to have a text interpretation appear below or above the barcode symbol, copy the text box and paste it in a suitable location on the form. Save and run the report. Verify the data that needs to be encoded appears in both text boxes.
    Creating the barcode text interpretation  Viewing the barcode text interpretation
  11. Reopen the report in Design Mode. Right-click on the detail section of the report, choose Build Event, and then choose Code Builder.
    Build Event Code Builder
  12. The Visual Basic Editor will open. The code builder may insert text automatically; remove any text that appears in the editor.
  13. Copy and paste the following text into the editor so it is the only text appearing:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
        result = IDAutomation_NatG_C128(txtIDAutomationBC1, Me)
    End Sub
  14. If a symbology other than Code 128 is necessary, modify the function so that IDAutomation_NatG_C128 is changed to the name of the function used to create the barcode. txtIDAutomationBC1 is the name of the text field that is to be encoded in the barcode. For example, the following code is used for QR Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
       result = IDAutomation_NatG_QRCode(txtIDAutomationBC1, Me)
    End Sub
  15. To create the barcode with default options, skip this step. To modify the size of the symbol or other parameters of the barcode, place a comma after "Me" to view available options. To gain greater control over the size of the barcodes, or to create very small symbols, the DPI must also be changed to 600 or greater. The size is determined by the Mils parameter, which is 1/1000 of an inch. To convert from CM, use the formula (Desired CM) * 393 = Mils and round up to a whole number.
    To modify the size of the symbol or other parameters of the barcode, place a comma after "Me"
    To generate the Swiss QR Bill at 17 mils, 600 dpi, and symbol version 23, use the following code:
    Private Sub Detail_Print(Cancel As Integer, FormatCount As Integer)
    result = IDAutomation_NatG_QRCode(IDAutomationQRCode1, Me, 17, 600, 0, 1, 0, 0, 23) End Sub
  16. Save and run the report to verify barcodes are being properly created. If the barcode does not appear, check the security settings, double-check all steps of this process, and refer to Technical Support. To adjust the width of the barcode symbol, change the MILS setting accordingly. The height of the symbol in linear barcodes is determined by the size of the associated text box.
    Barcode result in the access report
  17. For testing purposes, IDAutomation offers the Barcode Decoder App. This app is particularly useful in verifying lower ASCII codes, GS1 data, and UTF-8 Unicode encoding. 

Form Barcode Integration

The process of generating native barcodes on a form is only available in 2020 or later versions of this product. If you previously purchased the product and need this functionality, please update your Support and Upgrade Subscription to obtain the latest version.

  1. Extract the files from the Access Native Barcode Generator package.
  2. Open the database where the barcode is needed.
  3. Press ALT-F11 to open the Visual Basic Editor. If ALT-F11 does not work, in Access 2000 or 2003 choose Tools - Macro - Visual Basic Editor. For Access 2007 and above, choose Database Tools - Visual Basic.
  4. From the Visual Basic Editor, choose File - Import File and import the appropriate VBA module from the files extracted.
    Embedding the Barcode VBA Module
    Once the files are imported, they become embedded in the database file.
  5. Choose File - Save and then close the Visual Basic Editor. All functions of the Access Native Barcode Generator are now embedded in the database.
  6. Open the Access Example database provided with the product and open the Form Example in Design View.
  7. Right-click on the barcode field and choose Copy; paste the field into your database where it is needed on the form.
  8. After pasting the field, right-click on it and choose properties. Change the Control Source so that the information within the brackets is retrieving the data that needs to be encoded in the barcode in the Table.Field format.
    =IDAutomation_Nat_C128([Table1.Field1])
  9. The font of the field should already be set to Courier New at 5 points or greater for linear barcodes or 4 points or greater for 2D barcodes. The size must be large enough to be easily decoded by the scanner. The font size may be adjusted according to the following chart:
    Point Size Notes about point size and symbol distortion
    3 12 Mils (.03cm)
    • To scan from the screen of a Windows PC, the best sizes to use are 5, 10, 12, or 16 points.
    • If distortion is noticed, slightly adjust the point size up or down in 1-point increments until a correct symbol is obtained.
    • The X dimensions are doubled for 2D matrix symbols such as Data Matrix and QR-Code. For example, a QR-Code printed at 5 points will have an X of 40 Mils.
    • The X dimensions are approximate and may change with different resolutions of screens.
    • To reduce the size even more by about 50%, download the Universal 2D Font and install the “IDAutomation2D S” font from the package. After installation, select the “IDAutomation2D S” font instead of Courier New or Consolas to generate the symbols. When using the IDAutomation2D S font, refer to the Specifications to determine the point size.
    4 16 Mils (.04cm)
    5 20 Mils (.05cm)
    6 24 Mils (.06cm)
    7 28 Mils (.07cm)
    8 32 Mils (.08cm)
    10 36 Mils (.09cm)
  10. If necessary, change the function of the barcode type. Options and function parameters such as barcode height end encoding mode can be changed from the default by placing a comma between the bracket and closing parentheses.
  11. Size the text box so that it is large enough for the barcode that is going to be generated. If distortion is noticed, increase the size even more.
  12. Save and view the form to verify barcodes are being properly created. If barcodes are not properly generated, refer to the access example provided in the product package to determine the problem by process of elimination. If white lines and a distorted symbol appear, it is usually because the field is not large enough to properly contain the symbol generated.
    Truncated barcode object
  13. Barcodes on forms may also be generated in code and displayed on a label on a form. This method should only be performed by experienced access code developers and is implemented by referring to the code in the access example provided.

Creating GS1-128

IDAutomation includes the capability in this product to create barcodes and text for GS1-128 (UCC/EAN128) symbols with the Apply Tilde feature. The following describes the changes in the Code and the Control Source selections of the Barcode Integration Tutorial to implement GS1-128. The GS1-128 symbol is created from 17 digits of numbers in the GS1DataField field.

  • Change the ApplyTilde option in Step 15 to "True." The result line should be similar to the following:
        result = IDAutomation_NatG_C128(txtIDAutomationBC1, Me, 12, True)
  • The Control Source selection in Step 8 must be changed to a formula that properly encodes GS1-128 barcodes, for example:
           ="Ê" & [GS1DataField] & "~m17"
  • The IDAutomation_C128HR function may be utilized as the control source for the text interpretation in Step 10 to place the parenthesis in the correct locations of the text. For example: =IDAutomation_C128HR ("Ê" & [GS1DataField] & "~m17" ) 

Creating GS1-Data Matrix

The following describes the changes in the Code and the Control Source selections of the Barcode Integration Tutorial to implement GS1-DataMatrix.

  • Change the Encoding Mode and enable ApplyTilde in Step 15. The result line should be similar to the following:
    result = IDAutomation_NatG_DataMatrix(IDAutomationDataMatrix1, Me, 20, 300, 1, 3, -1, 0)
  • The Control Source selection in Step 8 must be changed to a formula that properly encodes the FNC1, for example:
    ="(10)123456789(21)" & [NumberData] 
  • IDAutomation recommends testing the result with the GS1 Data Decoder App.

Creating GS1-QR Code

The following describes the changes in the Code and the Control Source selections of the Barcode Integration Tutorial to implement GS1 QR-Code.

  • The result line should be similar to the following:
    result = IDAutomation_NatG_QRCode(IDAutomationQRCode1, Me, 20, 300)
  • The Control Source selection in Step 8 must be changed to a formula that properly encodes the FNC1, for example:
    ="~1" & [GTIN] & "8200" & "https://www.idautomation.com"
  • IDAutomation recommends testing the result with the GS1 Data Decoder App.

Generating Multiple Barcode Symbols on one Report

IDAutomation includes the capability to create multiple barcode symbols in the same report. The following describes the changes in the Code and the Control Source selections of the Barcode Integration Tutorial to allow multiple symbols to be created:

  • Add a text box for each barcode needed in the report, described in Steps 7 through 10.
  • Give each text box a unique name instead of the standard name recommended in Step 8. For example, use txtIDAutomationBC1 for the first barcode and txtIDAutomationBC2 for the second.
  • Add additional result lines for each unique text box name that is to contain a barcode, described in Step 13. For example:
    Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
        result = IDAutomation_NatG_C128(txtIDAutomationBC1, Me)
        result = IDAutomation_NatG_C128(txtIDAutomationBC2, Me)
    End Sub

Functions of the Access Native Barcode Generator

The result line in Step 13 of this tutorial may be altered to produce various different barcode types, which are listed below. For example, to create a Code 39 barcode, the result line on step 13 may look similar to:
result = IDAutomation_NatG_C39(txtIDAutomationBC1, Me)

Function Properties:

Parameters may be modified as necessary. Click the links of the following parameter properties list for more details.

  • TextControlName - The name of the text control as specified in Step 8.
  • ReportControlName - The name of the report where the barcode is to appear. This should normally be set to "Me," which is the current report.
  • DataToEncode - This string value represents the data being encoded.
  • ExpandedStackedSegments - In Databar Expanded, the number of segments to generate a stacked symbol from 2-22; 4, 6, and 8 usually work best.
  • Height - Applicable for DataBar is 13, 24, or 34. Default is 24.
  • Mils - The X dimension, which is measured at 1/1000 of an inch, where 12 is the default. This value changes the width of the barcode symbol.
  • ApplyTilde - When True, encodes functions with the ~ character. QR Code 2022 and later in this product adds support for TLV and Base64 encoding.
  • N_Dimension- Determines the width of the wide bars, which is a multiple of the X dimension. Valid values are 2 and 3. The default is 2.
  • IncludeCheckDigit - A Boolean value that specifies whether a check digit should be automatically calculated and included for the DataToEncode.
  • DPI - The dots-per-inch the graphic is generated for, where 300 is the default. When using a printer with lower or higher resolution, this value may be modified to produce a more accurate symbol. An accurate symbol can only be created on a 203 DPI printer when this value is set to 203.
  • Orientation - Values of 0, 90, and 270 degrees are supported.

Barcode Functions (used in the result line of Step 13)

Linear Symbologies
Symbology Formula
Code-128 Auto IDAutomation_NatG_C128 (TextControlName, ReportControlName, Mils, ApplyTilde, DPI, Orientation)
Code 128 A IDAutomation_NatG_C128A(TextControlName, ReportControlName, Mils, DPI, Orientation)
Code 128 B IDAutomation_NatG_C128B(TextControlName, ReportControlName, Mils, DPI, Orientation)
Code 128 C IDAutomation_NatG_C128C(TextControlName, ReportControlName, Mils, DPI, Orientation)
Code-39 IDAutomation_NatG_C39(TextControlName, ReportControlName, Mils, N_Dimension, IncludeCheckDigit, DPI, Orientation)
Code 93 IDAutomation_NatG_C93(TextControlName, ReportControlName, Mils, DPI, Orientation)
Codabar IDAutomation_NatG_Codabar(TextControlName, ReportControlName, Mils, N_Dimension, StartChar, StopChar, DPI, Orientation)
GS1DataBar IDAutomation_NatG_GS1DataBar(TextControlName, ReportControlName, Height, Mils, DPI, Orientation)
GS1DataBarExpanded IDAutomation_NatG_GS1DataBarExpanded(TextControlName, ReportControlName, ExpandedStackedSegments, Height, Mils, DPI, Orientation)
GS1DataBarStacked IDAutomation_NatG_GS1DataBarStacked(TextControlName, ReportControlName, Height, Mils, DPI, Orientation)
Interleaved 2 of 5 IDAutomation_NatG_I2of5(TextControlName, ReportControlName, Mils, N_Dimension, IncludeCheckDigit, DPI, Orientation)
MSI IDAutomation_NatG_MSI(TextControlName, ReportControlName, Mils, N_Dimension, IncludeCheckDigit, DPI, Orientation)
Intelligent Mail IDAutomation_NatG_IntelligentMail(TextControlName, ReportControlName, Mils, DPI, Orientation)  (aka: USPS IMb)
Postnet IDAutomation_NatG_Postnet(TextControlName, ReportControlName, Mils, IncludeCheckDigit, DPI, Orientation)
Planet IDAutomation_NatG_Planet(TextControlName, ReportControlName, Mils, IncludeCheckDigit, DPI, Orientation)
2D Symbologies
Data Matrix IDAutomation_NatG_DataMatrix(TextControlName, ReportControlName, Mils, ApplyTilde, EncodingMode, PreferredFormat, DPI, Orientation)
PDF417 IDAutomation_NatG_PDF417(TextControlName, ReportControlName, Mils, EccLevel, ColumnSpecify, RowSpecify, Truncate, ForceBinary, DPI, Orientation)
QR-Code IDAutomation_NatG_QRCode(TextControlName, ReportControlName, Mils, DPI, Orientation, ApplyTilde, EncodingMode, ErrorCorrectionLevel, Version, ProcessMask)
Text Functions (used in the text interpretation of Step 10)
IDAutomation_C128HR (DataToEncode, ApplyTilde) 
This function is used to format text for GS1-128 barcode types.
IDAutomation_SpliceText (DataToEncode, SpacingNumber, ApplyTilde)
This function is used to separate text digits into even segments to ease readability.
MODU10(DataToEncode)
This function generates a GS1 MOD10 check digit.

Technical Support & Troubleshooting

Common Problems and Solutions:

Barcodes do not Appear in the Report - Change Security Settings:

  • A security setting may be the cause. Security may need to be changed to allow VBA macros to run.
    • To enable macros to run in Access 2000 & 2003: Choose Tools - Macro - Security.
      Change the security level to Medium or Low.
      Close the database and reopen it. Macros should now be enabled.
    • To enable macros to run in Access 2007 and up: Open "Customize Quick Access Toolbar" menu to the right of the office button.
      Select "More Commands."
      Choose the "Trust Center" menu button on the sidebar.
      Choose the "Trust Center Settings" button on the main pane.
      Choose the "Macro Settings" menu button on the sidebar.
      Select "Enable all macros."
      Choose "OK" to close Trust Center.
      Choose "OK" to close Access Options.
      Close the database and reopen it. Macros should now be enabled.

Barcode is Truncated:

  • Size or move the text box object as described in Step 7 above.

Barcodes do not Scan with Default Settings:

  • Check to make sure that the barcode type is enabled in the scanner and that there is sufficient white space surrounding the barcode. Additional solutions for this issue are provided in the Barcode will not scan KB article.

Access Reports run Slow:

  • Encoding a large amount of data with PDF417 or Data Matrix may cause reports to slow down because of the complex calculations that must be performed in VBA code for the generation of these symbols. If this issue is observed, consider decreasing the amount of data being encoded or using a PC with more processor cores and memory.

Scanning Problems with Small Barcode Sizes:

  • Verify a printer of 300 DPI or greater is being used. An X dimension of 12 MILS or greater should be used with low-resolution thermal 203 DPI printers. IDAutomation also offers many barcode fonts that print well to low-resolution thermal printers. Additionally, verify the scanner being used is able to read small barcodes.

Verification of FNC1 Codes, GS1 data, TLV, Base64, lower ASCII or UTF-8:

  • IDAutomation offers the Barcode Decoder App, which is particularly useful in verifying encoded data.

How to make the Barcode Size Smaller:

  • The size can be easily changed in reports by modifying the MILS parameter. The size of the barcode may be changed in forms by reducing the point size. For more information, refer to the Access Barcode Size incident.

Popular Forum Post Resolutions:

Additional problems and solutions are provided on the IDAutomation barcode font troubleshooting page and by searching resolved public forum threads. Priority phone, email, and forum support are provided up to 30 days after purchase. Additional priority phone, email, and forum support may be obtained if the Priority Support and Upgrade Subscription is active.