Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Report Viewer "This field name is not known." 1

Status
Not open for further replies.

AdHoc

MIS
Feb 9, 2001
21
US
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.
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
 
Good suggestion. I verified the database (an Oracle stored procedure) but still got the same result. To make sure it really was verifying I changed the name of the procedure, added a dummy field to the procedure, did a set location for the report, saved it - everything I could think of to make sure it was in synch with the database. It still runs OK in CR but not in CRviewer. Thanks anyway.
 
OK. I finally found the problem by deleting each field, formula and running total in the report, one by one, until the report would finally run in crviewer. It turns out the culprit was a conditionally suppressed running total that was no longer used in the report. The formula that conditioned whether to suppress this unused running total refered to a field that was no longer in the underlying stored procedure for the report. This error wasn't detected when running the report in the CR designer, nor by doing a "verify database" because the field was no longer really used by the report. However, crviewer could not get past it and kept stopping with the very uninformative message "This field name is not known", which kind of begged the question "What field name is not known?" So now I know.
 
I have the same problem with you. And I wonder why the error still the same when there is no field that was not used, I meant every field is used.

I runs well when there is no more selection formula in the report. And I need this selection formula.

Do you have a better explanation and problem solving ?
 
Please post your formula and indicate the location of the cursor or which field name is not known.

Also, does your formula use an user defined functions? These functions are typically available via a third party .dll that needs to be registered. NumbertoDate() is an example of a third party UFL. If the .dll is not registered, crystal will not recognize this as a function and will return the error "field name not known" when it encouters your UFL.

Software Sales, Training, Implementation and Support for Exact Macola, eSynergy, and Crystal Reports
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top