|
Special! Spend Over $100.00 any any barcodes, or barcode software & get our Complete Excel Training Course OR Ozgrid Add-ins Collection FREE! Or, spend Over $200.00 and get both! Send payment confirmation to [email protected] 31 Days After Purchase.
Below, we list 3 popular methods of including barcodes in ActiveReports.
- Self-checking Fonts, MICR and OCR fonts (Best method for Code 39)
- Visual Basic barcode font module with barcode fonts
- ActiveX Control (Best option for UCC-128, EAN-128, PDF417, DataMatrix and MaxiCode)
Method 1 - using Self-Checking Fonts, MICR and OCR fonts
Self-Checking Barcode Fonts, MICR and OCR fonts are compatible with ActiveReports and may be used with ease. To use a self-checking font such as Code 39, you need to insert a "*" before and after the data encoded. Therefore, if you encode AR3OF9 in a barcode, you would need to display the text *AR3OF9* in a field with the Code 39 font selected. In this method, we describe an easy way to do this.
- First, you must install one of our Code 39 font packages. We recommend the Code 39 Font Advantage Package because this package includes several fonts in different heights.
- Start Visual Basic and open the ActiveReport to which you need to add the barcode.
- On the ActiveReport toolbox, choose the TextBox control and create a text box on your report that is large enough to include the barcode. Make a note of its name, in this case it is Field1.
- Double-click on a blank area in the report to show the report code.
- Add the following code to the report where Field1 is the name of the TextBox that will contain the barcode, NumberData is the field from the database you wish to include in the bar code and DAODataControl1 is the data control.
Private Sub ActiveReport_FetchData(EOF As Boolean)
If DAODataControl1.Recordset.EOF Then Exit Sub
Field1.Text = "*" & DAODataControl1.Recordset("NumberData") & "*"
End Sub- Run the report to make sure the asterisk is appended to the beginning and end of the data that is retrieved from the data source.
- Go back and edit your ActiveReport. Change the font of the field to contain the barcode to one of our Code 39 barcode fonts and run the report again. You should now see the barcode.
- With Code 39, you can also easily add tabs between two fields in a single barcode (in extended39) for example:
=("*"&[DataField1] & "$I" &[DataField2] & "*")
Method 2 - using our Visual Basic barcode font module with barcode fonts
Barcode fonts such as UPC, EAN, Code 128, Interleaved 2 of 5 and MSI require calculations to be performed to determine the check character. To assist our font users with this, we provide a Visual Basic project module. The functions of this module can also be used in an ActiveReport. In this example, we will add UPC/EAN-128 barcodes to a report. For a list of functions included in our module, refer to the function list at our VBA code site.
- First, you must install one of our font packages. If you are unsure of which to install, we recommend the Code 128 Font Advantage Package because this package includes several fonts in different heights and it encodes all letters and numbers.
- Start Visual Basic and open the ActiveReport to which you need to add the barcode.
- In Visual Basic, Choose Project - Add Module.
- Select the ID-AutomationVBA.bas file.
- ox, choose the TextBox control and create a text box on your report that is large enough to include the barcode. In this example, we are going to include formatted "Human Readable" text below the barcode as required for UCC/EAN-128 specifications. If you wish to add "Human Readable" text, add another field and place it on the form. Make a note of the field names, in this case they are Field1 and Field2.
- Double-click on a blank area in the report to show the report code.
- Add the following code to the report where Code128() is the function, Field1 is the name of the TextBox that will contain the barcode, NumberData is the field from the database you wish to include in the bar code and DAODataControl1 is the data control. For a list of functions included in our module, refer to the function list at our VBA code site.
Private Sub ActiveReport_FetchData(EOF As Boolean)
If DAODataControl1.Recordset.EOF Then Exit Sub
Field1.Text = Code128(DAODataControl1.Recordset("ucc128"), 0)
Field2.Text = Code128(DAODataControl1.Recordset("ucc128"), 1)
End Sub- Run the report to make sure the data is being pulled from the fields and properly formatted to the barcode font. You should see that some strange characters have been appended to the beginning and ending of the data from the fields - this is normal. Sometimes the data has to be formatted so much it appears to be scrambled. This is normal for Code 128 and Interleaved 2 of 5 when numbers need to be compressed within the barcode. In the graphic below, the first string is produced by the Code128(DAODataControl1.Recordset("ucc128"), 0) formula and the second one is produced by the Code128(DAODataControl1.Recordset("ucc128"), 1) formula.
- Go back and edit your ActiveReport. Change the font of the field to contain the barcode to the appropriate barcode font. In this case, we selected the ID-AutomationC128M font to create a Code-128 barcode.
- Now, when the report is run we see the barcode created in the field1 text box.
- You may include multiple fields in a single barcode by changing the field formula. For example, to include two fields (sscc18 and ucc128) in a single code 128 barcode with a tab function between them we use the following formula:
Field1.Text = Code128(DAODataControl1.Recordset("sscc18") & Chr(9) & DAODataControl1.Recordset("ucc128"), 0)
You may use Chr(9) for a tab and Chr(13) for a return.
Method 3 - using the ActiveX Control and DLL with Active Reports
Our ActiveX Control and DLL products may be easily used in ActiveReports. We have linear symbologies available as well as 2D barcodes such as PDF417, Data Matrix and Maxicode. In the example below, we will include a code 128 barcode in a report. Our ActiveX Control is very useful in ActiveReports because the control automatically formats "Human Readable" data for AIs in UCC128 and EAN128 barcode types.
Special! Spend Over $100.00 any any barcodes, or barcode software & get our Complete Excel Training Course OR Ozgrid Add-ins Collection FREE! Or, spend Over $200.00 and get both! Send payment confirmation to [email protected] 31 Days After Purchase. All purchases can be made via Id-Automations site
Instant Download and Money Back Guarantee on Most Software
Excel Trader Package Technical Analysis in Excel With $139.00 of FREE software!
Microsoft � and Microsoft Excel � are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft
GIVE YOURSELF OR YOUR COMPANY 24/7 MICROSOFT EXCEL SUPPORT & QUESTIONS