2D Barcode Tools for Crystal Reports > Crystal Reports Designer for VB6

Step 4

Enter the code required to create the barcode from data in your chosen source field.

The code required here will frequently be very similar to that shown below, in fact if you have a field named Field5 on the report you can copy and paste this code directly into code window.

 

Private Sub scnDetail_Format(ByVal pFormattingInfo As Object)

Dim twips As Single

twips = 1.7639                            ' 2540# / (72# * 20#)

Set barcode1 = CreateObject("dBarcode2D.Control")  'start dBarcode

barcode1.CodeType = 1                'set code type 0=Aztec, 1=Datamatrix, etc

barcode1.Xunit = 20                         'X = 12 Mils

barcode1.Units=”mm”

barcode1.BorderSize=1                 ‘1 mm border

barcode1.Data = Field5.Value         ' this is the barcode data source

Set Picture3.FormattedPicture = barcode1.Picture

Picture3.Height = barcode1.PictureHeight / twips

Picture3.Width = barcode1.PictureWidth / twipsEnd Sub

 

 

 

More:

Step 5