Skip to Content
Jan 29, 2020 at 06:38 AM

Inconsistent Error "Load Report Failed"


I have one report out of several. All of them run on the problematic machine except this one. I have worked on this for 2 days now. Googling my heart out. I feel like it has to be something simple because the report works on my development machine. The application is VB.Net and it runs on the customer's machine when I load it into Crystal Reports 2016. But while it runs on the development machine, it does not run on any of the Client's machines. I have run CRLogger and it fails on a CR internal call as best I can tell. I think the problem must be in the way I am calling the report, but it works on the Dev Machine and fails in the field. The Customer is currently down. I will start working to see if I can back the changes out of the system. I realize this is quite long, but I am trying to give you enough information to allow you to better help. I have included the calling code below and the CRLogger results.

Here are the equipment specs:

Developer Machine

Visual Studio 2019, latest install. Only version of Visual Studio on the machine (installed in Admin Mode)

Dell XPS, Windows 10, 32 GB Ram, I7-9750H processor

Customer Machine

Visual Studio Runtime (Current Release installed with Admin Access)

Windows 10, 8 GB Ram, Intel I5-7500T


Calling Code


    Private Sub btnRunReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRunReport.Click
        Dim multi As Boolean = False
        Dim multiReport As New xtraReportFormMultiSelect

        If String.IsNullOrWhiteSpace(dtpDateEnding.Text) OrElse String.IsNullOrWhiteSpace(dtpDateStarting.Text) Then
            msgAlert("Please select a Starting and or Ending Date before running report.")
            Exit Sub
        End If

        If dtpDateEnding.EditValue < dtpDateStarting.EditValue Then
            msgAlert("The Starting Date can not be greater than the Ending Date.")
            Exit Sub
        End If

        If lstAssign.SelectedItems.Count = 0 Then
            msgAlert("Please Confirm Employee Selection first.")
            Exit Sub
        End If

        If lstAssign.SelectedItems.Count > 1 Then
            'We have multiple Parameters to deal with
            multi = True
        End If

        ' Clear the discrete parameter fields
        multiReport.crParameterDiscreteValue = Nothing
        multiReport.crParameterFieldDefinitions = Nothing

        multiReport.ItemsSelected = lstAssign.SelectedItems
        multiReport.MdiParent = Me.MdiParent

        If radEmpWkDt.Checked Then
            multiReport.strReportName = "rptemplwrkdt2l.rpt"

        ElseIf radEmpMile.Checked Then
            multiReport.strReportName = "rptempmileage.rpt"
        ElseIf radEmpReim.Checked Then
            multiReport.strReportName = "rptempreimbursement.rpt"
        ElseIf radEmpPurchase.Checked Then
            multiReport.strReportName = "rptemppurchase.rpt"
            msgAlert("Please select a report before continuing.")
        End If

        multiReport.cryRpt.Load(reportPath & multiReport.strReportName)
        Call SetReportSQL(My.Settings.BMI6ConnectionString, multiReport.crV1, multiReport.cryRpt)

        'Apply Start and End Dates

        'New Date Ending Routine
        Dim par As ParameterValues
        Dim ParD As New ParameterDiscreteValue()
        par = multiReport.cryRpt.ParameterFields.Item("dateEnding").CurrentValues
        ParD.Value = dtpDateEnding.Text

        'New Date Starting
        par = multiReport.cryRpt.ParameterFields.Item("dateStarting").CurrentValues
        ParD.Value = dtpDateStarting.Text

        ' EmpNo New Routine
        par = multiReport.cryRpt.ParameterFields.Item("empno").CurrentValues

        Dim Count As Integer = lstAssign.SelectedItems.Count

        For i = 0 To Count - 1
            ParD.Value = lstAssign.SelectedItems(i)




    End Sub

    Public Sub SetReportSQL(ByVal ConnectionString As String,
                   ByRef CrystalReportViewer As CrystalDecisions.Windows.Forms.CrystalReportViewer,
                   ByRef reportDocument As ReportDocument)
        'Get SQL Server Details
        Dim builder As New SqlClient.SqlConnectionStringBuilder

        builder.ConnectionString = ConnectionString

        Dim zServer As String = TryCast(builder("Data Source"), String)
        Dim zDatabase As String = TryCast(builder("Initial Catalog"), String)
        'Dim zSecurity As Boolean = Boolean.TryParse(builder("Persist Security Info"), zSecurity)
        Dim zSecurity As Boolean = Boolean.Parse(builder("Persist Security Info"))
        Dim zUsername As String = TryCast(builder("User ID"), String)
        Dim zPassword As String = TryCast(builder("Password"), String)

        Dim ciReportConnection As New ConnectionInfo

        ciReportConnection.ServerName = zServer
        ciReportConnection.DatabaseName = zDatabase
        ciReportConnection.IntegratedSecurity = zSecurity
        If zSecurity = False Then
            ciReportConnection.UserID = zUsername
            ciReportConnection.Password = zPassword
            reportDocument.DataSourceConnections(0).IntegratedSecurity = True
        End If

        'Assign data source details to tables
        For Each table As Table In reportDocument.Database.Tables
            table.LogOnInfo.ConnectionInfo = ciReportConnection

        For Each subrep As ReportDocument In reportDocument.Subreports
            For Each table As Table In subrep.Database.Tables
                table.LogOnInfo.ConnectionInfo = ciReportConnection

        'Assign data source details to the report viewer
        If CrystalReportViewer.LogOnInfo IsNot Nothing Then
            Dim tlInfo As TableLogOnInfos = CrystalReportViewer.LogOnInfo
            For Each tbloginfo As TableLogOnInfo In tlInfo
                tbloginfo.ConnectionInfo = ciReportConnection
        End If
        CrystalReportViewer.ReportSource = reportDocument
    End Sub

CRLogger Code:


2020-1-29-0-44-8	1576	QESession.cpp	445	Set Product View Locale: 1033	20

2020-1-29-0-44-8	1576	QESession.cpp	479	Set Preferred View Locale: 1033	20

2020-1-29-0-44-8	1576	QESession.cpp	501	Set Process Locale: 1033	20

2020-1-29-0-44-8	1576	qecommon.cpp	117	This property is currently in a read-only state and cannot be modified. File Name: "QEProperty.cpp". Line: 217	1

2020-1-29-0-44-12	1576	..\..\src\print\format\imageretriever.cpp	925	Destroy API called. Image Retriever was not used. No cleanup necessary.	20

Assert File

2020-1-29-0-44-8	1576	..\..\src\crpe\crpemain.cpp	461	FALSE