Create Data Matrix 2D Barcodes in Crystal Reports

Data Matrix 2D Barcodes in Crystal Reports

  • This tutorial shows how to add Data Matrix barcodes to your Crystal Reports.

Step 1. Add a new formula

  • In the Field Explorer, right click Formula Fields and click New...
Add a new formula for Data Matrix barcodes
  • Enter a name for the new formula.
Enter formula name - MyDataMatrixBarcode

Step 2. Verify the Data Matrix functions

  • Ensure the functions are installed. May be listed under one of these two locations:
    Functions > Additional Functions > Visual Basic UFLs (u2lcom.dll)
    Functions > Additional Functions > COM and .NET UFLs (u212com.dll)
  • If missing, install the User Function Library
Enter formula name - MyDataMatrixBarcode

Step 3. Copy the formula text

  • Copy the contents of this text into the Formula Editor

Step 4. Is your data field a String or Number?

  • Check the Field Explorer to see whether your field is a String or a Number. To show the field type, right-click on Database Fields and check Show Field Type.
  • In this example, item_sku is a Number.
Enter formula name - MyDataMatrixBarcode
  • If your field is String, follow Step 5a. If Number, follow Step 5b.

Step 5a. (For String Fields): Edit the formula:

  • Delete the first two lines and uncomment the third.
Add Function Name to Crystal
  • Replace {example_data_csv.item_name} with your own data field.
  • Click Save and Close.
  • Continue to Step 6.

Step 5b. (For Number Fields): Edit the formula:

  • Replace {example_data_csv.item_name} with your own data field.
  • Click Save and Close.
Add Function Name to Crystal

Step 6. Add a barcode to the report

  • Drag the formula from Field Explorer to the report
Add barcode to the report

Step 7. Edit the text field

  • Change the font to: BCW_2D
  • Right-click and select Format Field...
  • Select Can Grow on the Common tab

The report is now ready

  • Click on Preview to see or print it.
Print preview the report