For you to be able to connect VB6 program to Crystal Report XI reports, first add this Component;

Crystal ActiveX Report Viewer Library 11.5

Add Reference;

Crystal Reports ActiveX Designer Run Time Library 11.5

Go to your Form, drag and drop CrystalActiveXReportViewer1 to your form, then to your program code, add this;


Private Sub Form_Load()

Dim crApp As New CRAXDRT.Application
Dim crRept As New CRAXDRT.Report

' Open Report File
Set crRept = crApp.OpenReport("whatever.rpt")

' Disable Parameter Prompting for the end user
crRept.EnableParameterPrompting = False
crRept.ParameterFields.Item(1).AddCurrentValue "12345"

CrystalActiveXReportViewer1 .ReportSource = crRept
CrystalActiveXReportViewer1 .ViewReport

End Sub

That’s it! Enjoy!

SHARE

LEAVE A REPLY