How to Generate Data Matrix Barcodes in Microsoft Access
A comprehensive guide to integrating scannable Data Matrix barcodes into your Microsoft Access reports using VBA modules and Barcodesoft fonts.
1 Adjust Access Macro Security
To enable barcode encoding scripts, you must configure your security settings to allow macros to run within the Access database environment.
For Access 2000 or 2003:
Navigate to Tools > Macro > Security and select Low security level.
For Access 2007 to 2019 / Office 365:
Click the Office Button/File > Access Options > Trust Center. Under Macro Settings, select "Enable all macros".
2 Initialize VBA Library References
Open the Visual Basic Editor by pressing ALT + F11.
Go to Tools > References. Click Browse and navigate to the directory containing cruflbcs.dll.
Check the box for crUFLBcs 4.0 Type Library and click OK.
3 Import the Data Matrix VBA Module
Press Ctrl + M and select barcodesoft.bas from the Barcodesoft folder to import the necessary encoding logic.
If the file is missing, download the module here: Data Matrix VBA Download.
4 Create Barcodes in Access Reports
Close the VBA editor and return to Access. Open a report in Design View. In the text box where you wish to display the barcode, enter the following formula in the Control Source:
Replace TableName with your actual table name and FieldName with the data source field.
5 Apply the Barcode Font
Right-click the text box field and select Properties. Under the Format tab, set the Font Name to BcsDatamatrix.
Ensure the field size is large enough to contain the 2D grid of the Data Matrix barcode.