Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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.
 Try
            
            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)
            crParameterValues.Add(crParameterDiscreteValue)
            crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
 
            ReportViewForm.CrystalReportViewer1.ReportSource = cryRpt
            ReportViewForm.CrystalReportViewer1.Refresh()
 
            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
            cryRpt.Export()
            Process.Start(SavingString)
            MainForm.WindowState = FormWindowState.Minimized
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
Posted 30-May-12 5:19am
Edited 30-May-12 5:39am
v2
Rate this: bad
good
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[^]
  Permalink  
Rate this: bad
good
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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 190
1 PIEBALDconsult 150
2 BillWoodruff 148
3 DamithSL 140
4 Jochen Arndt 125
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 15 Nov 2012
Copyright © CodeProject, 1999-2014
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