When trying to view a report using VB6 and the crviewer.dll it lets the report prompt for parameters and then gets stuck with an error message box titled "Crystal Report Viewer" and the error is "This field name is not known." This happens only with a couple of my reports and I can't see the difference between these and the other reports that I can view with no problem in crviewer.
I can run the problem reports in the Crystal Reports designer software with no error. I tried editing each formula and checking for errors, finding none. I even tried deleting all the formulas and trying to run the report from VB -- same error. Do I have to start with a new blank report and rebuild it piece by piece? Is there any better way to get crviewer to reveal what field name is not known?
Here is a simplified example of the code that works for most, but not all of my reports.
I can run the problem reports in the Crystal Reports designer software with no error. I tried editing each formula and checking for errors, finding none. I even tried deleting all the formulas and trying to run the report from VB -- same error. Do I have to start with a new blank report and rebuild it piece by piece? Is there any better way to get crviewer to reveal what field name is not known?
Here is a simplified example of the code that works for most, but not all of my reports.
Code:
Private Sub Form_Load()
Dim crxApplication As New CRAXDRT.Application
Dim Report As CRAXDRT.Report
Set Report = crxApplication.OpenReport _
("p:\bhisrpts\HB-FOR-006.rpt")
Report.Database.Tables.Item(1).SetLogOnInfo "MyDSS", , "MyUser", "MyPassword"
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
End Sub