Discussion Locked

CALLING IN THE A CRYSTAL REPORT IN VB 6

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How do i call in a crystal report from:
(1) A form
(2) Crystal report viewer

1 reply

by miss kitty

You need to add the Crystal Report Control and Viewer to your project. You do that under the Projects/components/reference.
Then here is an example of code that calls in the crystal viewer:

Dim crxApplication As New CRAXDRT.Application
Public Report As CRAXDRT.Report

Dim crxDatabaseTable As CRAXDRT.DatabaseTable
Dim crxParameterField As CRAXDRT.ParameterFieldDefinition
Dim crxFormulaField As CRAXDRT.FormulaFieldDefinition
Set Report = crxApplication.OpenReport _
("E:\PLTERA\CRYSTAL REPORTS\HAULER REPORTS\Contract Haulers Report.rpt", 1)
frmViewer.Show vbModal

On the form that has the viewer, here is a sample of the code for it:

Private Sub Form_Load()
'Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = frmReports.Report
CRViewer1.ViewReport
End Sub

This should get you going.
Cathy

This discussion is closed to new replies.