Hi all,

I posted a question about how to use Crystal Report, and I
got a sample from DavidRobin, but I could not figure it out.

I paste the code he provided, but it would not compile. The
compiler is complaining that the User-defined type not defined and the lines it does not like are the two
dims below:

Dim Appl As CRAXDRT.Application
Dim Report As New CRAXDRT.Report

What Project->References or Project->Components must I
attach?

Here is the sample code David provided:


' holds the report file path
Private mRepFile As String

Private Sub Form_Load()
Set Appl = New CRAXDRT.Application
Set Report = Appl.OpenReport(mRepFile)
Report.DiscardSavedData
Report.Database.Tables(1).SetLogOnInfo <database>, , <UserID>, <password>

CRViewer1.ReportSource = Report
CRViewer1.ViewReport

CRViewer1.Top = 0
CRViewer1.Left = 0
End Sub

Private Sub Form_Resize()
' keeps the CRViewer the same size as the form
CRViewer1.Width = Me.ScaleWidth
CRViewer1.Height = Me.ScaleHeight
End Sub

' Property to allow the report path to be passed in
Property Let ReportFile(rep As String)
mRepFile = rep
End Property

Private Sub Form_Unload(Cancel As Integer)
Set Appl = Nothing
Set Report = Nothing
End Sub
Private Sub mnuOutstanding_Click()
frmReportView.ReportFile = App.Path & "\Students.rpt"
frmReportView.Caption = "Crystal Report Viewer [Students.rpt]"
frmReportView.Show vbModal
frmReportView.ReportFile = ""
Set frmReportView = Nothing
End Sub