Generate Code 128 Barcode in Crystal Reports
How to generate a Code 128 barcode in Crystal Reports?
To generate a Code 128 barcode in Crystal Reports, create a new formula field using the BCSLinearCode128 function from the Barcodesoft UFL library. Pass your database fields as arguments, place the formula field on your design canvas, and apply the Code128MHr font family.
-
Step 1: Determine SAP Crystal Reports Bitness and Register DLL
Determine the bitness of your SAP Crystal Reports version. SAP Crystal Reports 2008 through 2016 are 32-bit, while SAP Crystal Reports 2020 and 2025 are 64-bit.
For 64-bit Crystal Reports (2020 / 2025):
Run Command Prompt as Administrator and execute:
cd "C:\Program Files\Common Files\Barcodesoft\FontUtil"
%systemroot%\System32\regsvr32.exe cruflbcs_x64.dll
For 32-bit Crystal Reports (2008–2016):
Run Command Prompt as Administrator and execute:
cd "C:\Program Files\Common Files\Barcodesoft\FontUtil"
regsvr32.exe cruflbcs.dll
-
Step 2: Create a New Code 128 Formula Field
Open your Crystal Report layout. Right-click Formula Fields in the Field Explorer pane and select New... from the context menu. Type "code128" in the Name textbox, then click the Use Editor button.
-
Step 3: Locate the Barcodesoft Code 128 Function
In the Formula Workshop, navigate to the Additional Functions directory and double-click the
BCSLinearcode128function listing located under the Visual Basic UFLs node.
-
Step 4: Use Your Database Field as a Parameter
Provide your target database field as the primary string parameter inside the formula brackets. Click the Save button to validate and preserve your new formula logic configuration.
-
Step 5: Insert code 128 Formula Field Into Your Report Canvas
Drag your newly saved
code128formula field out of the Field Explorer and drop it onto the design view grid canvas area where you want the barcode to appear.
-
Step 6: Apply the Code128MHr Font Typeface
Right-click the placed formula text block object on your canvas and choose Format Field from the context menu. In the Font customization tab pane, select "code128mHr" from the font family drop-down menu selection list.
-
Step 7: Verify Code 128 Barcode Generation
Click the OK button to apply changes. The text string placeholders will immediately transform and render as an active, readable Code 128 linear barcode inside your report template preview layout.