I recently upgraded from Crystal 9 Reports to Crystal 11 Developer. I run a series of different Crystal Reports through this application by looping through and calling a private sub procedure. The first report always runs correctly but any following reports fails with the following error:
Object reference not set to an instance of an object.
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
at ReportExecute_CR11.frmRtExeEngine.RunTaskInternal(Connection Conn, Boolean IsTrx) in C:\Local Projects\ReportExecute_CR11\frmRtExeEngine.vb:line 932 'this is where i call reportdocument.load()
I've changed the order of the reports and still only the first report runs. I am guessing this is some kind of licensing issue, but can't figure it out, as Crystal 11 Developer says it comes with 5 concurrent licenses. The DLL's I reference are CrystalDecisions.CrystalReports.Engine, CrystalDecisions.Shared, and CrystalDecisions.KeyCode. I do not have Report App Server. I call the below method (which i've simplified for readability) in a loop to finish the reports. This function works correctly with Crystal 8 and 9.
Private Sub RunTaskInternal(ByVal Conn As ADODB.Connection, Optional ByVal IsTrx As Boolean = False)
Dim Rt As New ReportDocument
Dim rtName As String
Dim XFT As ExportFormatType = ExportFormatType.PortableDocFormat
Rt.Load(GetLocation()) 'This is where the error occurs AFTER the first time i call RunTaskInternal()
'Load Permissions for tables
Rt = Nothing