Questions? Search our site or call us at 1-800-722-6004

Getting around the lack of ActiveX Control Support in Crystal Reports

Unlike Active Reports by Data Dynamics, Crystal Reports (at least Versions 8.5 and earlier) by Crystal Decisions (formally Seagate Software) does not support the use of ActiveX controls directly. While it is possible to insert the TAL Barcode ActiveX control into Crystal Reports as an OLE Object, there seems to be no way to set it's properties through code. (If anyone knows how to do this please contact us!) which means all you can do with it is print out the default barcode.

Solution

Either use Active Reports and save youself a lot of programming time, or use the ActiveX control in a Visual Basic Application that saves the barcodes as images and then inserts them into your report. Unfortunately there are no Crystal Reports Gurus here at TALtech, but we have played with Crystal Reports 7.0 and a demo version of 8.5. One of the Visual Basic Project demos that ships with the Crystal Reports 8.5 Report Designer Component shows how to load a picture at Runtime using the "onFormat event" of a section in the report:

' Using the FormattedPicture property of the OLEObject object,
' the VB LoadPicture Method can be used to change a picture image
' at runtime. This example changes the coupon depending on the
' customer's last year's sales
'
Private Sub Section12_Format(ByVal pFormattingInfo As Object)
Select Case fldLastYearsSales.Value
Case Is < 10000
Set picCoupon.FormattedPicture = LoadPicture(App.Path & "\Coup20.bmp")
Case 10001 To 20000
Set picCoupon.FormattedPicture = LoadPicture(App.Path & "\Coup30.bmp")
Case 20001 To 30000
Set picCoupon.FormattedPicture = LoadPicture(App.Path & "\Coup40.bmp")
Case Is > 30000
Set picCoupon.FormattedPicture = LoadPicture(App.Path & "\Coup50.bmp")
End Select
End Sub

Thus, it seems entirely possible that one could bind the ActiveX Control to a field in a database using Visual Basic's Database tools, then loop through a field in the database, save a barcode as an image file, and generate a report using Crystal Reports that uses the LoadPicture method technique above to insert the barcodes. It may also be possible to insert the barcodes as image files into an OLE field in your table and bind a picture field on the report to that field.

If anyone out there knows of a better way or has a working example that you would be willing to share with others please contact us!


Categories: Troubleshooting, Barcode ActiveX

Last Updated: 2011.07.06

Need more help?

Don't hesitate to call or email us with your questions

Our office is open 9AM - 5PM Monday Through Friday (E.S.T.)

Technical Support: 215-496-0202

Toll-Free: 1 (800) 722-6004
Skype: taltech1 (Voice only)
Email: support@TALtech.com