Skip to Content

"This field name is not known." from ReportDocument.Load(), so how to VerifyDatabase?

I have a Crystal Report file that I'm unable to even load, using the following VB.NET code:

Dim objRptDoc As New CrystalDecisions.CrystalReports.Engine.ReportDocument()

It throws a CrystalDecisions.Shared.CrystalReportsException

Message: Load report failed.
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)

With an InnerException of type System.Runtime.InteropServices.COMException

Message: This field name is not known.
Details: errorKind
Error in File my 17320_16748_{19E5E493-1D64-4084-8E97-6395D78D94EB}.rpt:
Error in formula SubTotal Label:
'If {Invoice.ForeignSubTotal} = {Invoice.ForeignTotalAmount} Then
This field name is not known.
Details: errorKind

at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()

Now I more or less know what the problem is... if I open the report in the Crystal Designer, do a Verify Database, and save it, it'll work fine. But I want to be able to do this automatically from my own code, rather than telling the user that they need to go run Verify Database on the report (especially since the user probably will not have access to the Crystal report designer). Normally, I'd call the ReportDocument.VerifyDatabase() method, but that assumes I already have the report loaded into the ReportDocument object. Since I can't even Load the report, I can't call VerifyDatabase.

Any advice on how I can accomplish this?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Sep 27, 2017 at 01:27 PM

    Interesting.... So it would appear your only option is to specifically test for the Inner Exception and pop up a message box "The report requires Verifying the Database in CR Designer only, the CR SDK is not capable of doing this at runtime"

    I've never seen this error before on open, it does suggest the report relies heavily on that field. Because the Engine loads all objects into memory and then validates them on open your only option is to fix the report first.

    I would still like the report so I can pass it by R&D to see if we can improve things on Open....

    Thanks again


    Add comment
    10|10000 characters needed characters exceeded

  • Sep 22, 2017 at 04:47 PM

    What version of CR for VS are you using?

    Later versions do not test the formula fields unless you specifically check them.


    Add comment
    10|10000 characters needed characters exceeded

  • Mar 28, 2018 at 10:08 PM

    Thank you for the report.

    I get this error in my Event handler, I have multiple so not sure which one is triggering it. Click on the CR Viewer and you'll be able to see which events you can trigger on.

    The formula looks normal

    I also get an error the saved data will be discarded in CR


    Add comment
    10|10000 characters needed characters exceeded