Click here to Skip to main content
12,401,324 members (40,047 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB Visual-Studio VS2010 , +
I am a newbie at this, and I have searched all the forums and haven't found the answer I am looking for. I have four reports and only two of which work, and the other two show "Load Report Failed." I have checked the code and they are all the same, the only difference is the number of parameters. I am not sure if this makes a different but one of my reports' size is 4064KB and this one of the two that came up with the error, it has 4 sub-reports within it. I have checked my file paths and given them full permissions, and made sure my password and ID are correct. I am using Crystal Report on VS2010 to export to PDF with a "quick click export button". All the reports work fine on my developing computer, but when I install it on another computer it gives me this issue. I had installed .net Famework 4 and Crystal Report Redistributable for 4.0 Framework, not sure if I need anything else. Here is my code for that one with 4 sub-reports, thank you in advance.
           Dim SavingString As String = ""
           'SavingString = "C:\Windows\Temp\" & CStr(Me.MillNameLabel1.Text) & "Quote" & CStr(Me.QuoteNumberLabel1.Text) & ".pdf"
           SavingString = "C:\Reports\" & CStr(Me.MillNameLabel1.Text) & "Quote" & CStr(Me.QuoteNumberLabel1.Text) & ".pdf"
           Dim cryRpt As New ReportDocument
           cryRpt.Load("C:\Program Files\ECSBOM\ECSBOM\ReportTemplates\QuoteReport.rpt")
           cryRpt.SetDatabaseLogon("CrystalReportUser", "123456")
           Dim crParameterDiscreteValue As ParameterDiscreteValue
           Dim crParameterFieldDefinitions As ParameterFieldDefinitions
           Dim crParameterFieldLocation As ParameterFieldDefinition
           Dim crParameterValues As ParameterValues
           crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
           crParameterFieldLocation = crParameterFieldDefinitions.Item("QuoteNumber")
           crParameterValues = crParameterFieldLocation.CurrentValues
           crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
           crParameterDiscreteValue.Value = CInt(Me.QuoteNumberLabel1.Text)
           ReportViewForm.CrystalReportViewer1.ReportSource = cryRpt
           Dim CrExportOptions As ExportOptions
           Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions()
           Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions()
           CrDiskFileDestinationOptions.DiskFileName = SavingString
           CrExportOptions = cryRpt.ExportOptions
           With CrExportOptions
               .ExportDestinationType = ExportDestinationType.DiskFile
               .ExportFormatType = ExportFormatType.PortableDocFormat
               .ExportDestinationOptions = CrDiskFileDestinationOptions
               .ExportFormatOptions = CrFormatTypeOptions
           End With
           MainForm.WindowState = FormWindowState.Minimized
       Catch ex As Exception
       End Try
Posted 30-May-12 4:19am
Updated 30-May-12 4:39am
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Since, the code is working for 2 reports and not for other 2 + locally, it works, you need to troubleshoot possible environment based reasons.

Load Report Failed - CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Invalid Report file path
Here troubleshoot with options given in the link: Invalid report file path[^]
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

If I were you I'd double check the version of Crystal Reports on your developer machine versus the version on the users' machine where the code fails. My unchanged code with SAP v13 Crystal Reports threw me CrystalDecisions.CrystalReports.Engine.LoadSaveReportException exception with the message "Invalid report file path". I also got CrystalDecisions.CrystalReports.Engine.InvalidArgumentException exception with the message containing "Invalid printer specified".

So dig down into the inner exception what the CrytalReports really threw, check out report file paths, printer settings and other properties you set. The new version seems to be more picky about the correctness of parameters.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 15 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100