0
votes

I have also posted this question in the Crystal Reports forum, with no answers yet. I have an application that was originally written in VS 2008 with Crystal Reports 2008. The original code works with no problems.

Similar to this post: Error message that says "No Error" from CR Viewer, I have just upgraded the Application to .net 4.0 and Crystal Reports 2010. The report viewer works fine the first time a report is loaded, but when I change the parameters on the report, and put the updated report back into the report viewer, I get the message shown above in a pop-up window. The report does not change its parameters and the updated report is not displayed. The code in question is setting the date parameters for the report. The user can select new date parameters from the form that encloses the report viewer. The code subclasses the Report Object code to add additional functions through interfaces. The IDateRange interface provides a starting and ending date range for the report using a property on the report class as follows:

Public Property EndingDate() As Date Implements IDateRange.EndingDate
    Get
        Return _endingDate
    End Get
    Set(ByVal value As Date)
        _endingDate = value
        Me.SetParameterValue("EndingDate", value)
    End Set
End Property

In addition, the immediate Window shows the following message:

A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in CrystalDecisions.CrystalReports.Engine.dll

The code in the Report Viewer looks like this, the line where the viewer report source is set for when pop-up appears:

''' <summary>
''' Sets the report period and displays it.
''' </summary>
''' <param name="Report">The Report.</param>
''' <param name="Refresh">if set to <c>true</c> force a refresh.</param>
Private Function PFSetReportPeriod(ByVal Report As Object, Optional ByVal Refresh As Boolean = True) As Boolean
    Dim fld As FormulaFieldDefinition
    Dim bRefresh As Boolean = False
    Dim rpt As ReportClass = CType(Report, ReportClass)
    Try
        If TypeOf rpt Is IDateRange Then
            With DirectCast(rpt, IDateRange)
                StartingDate = dtpFromDate.Value
                EndingDate = dtpToDate.Value
            End With
            SetTitleLine2(DirectCast(Report, ReportClass), bRefresh)
            bRefresh = True
        Else
            If TypeOf rpt Is ReportClass Then
               fld = rpt.DataDefinition.FormulaFields("FromDate")
               If Not fld Is Nothing Then
                    fld.Text = "Date(" & dtpFromDate.Value.Year & "," & dtpFromDate.Value.Month & "," & dtpFromDate.Value.Day & ")"
                    bRefresh = True
                End If
                fld = rpt.DataDefinition.FormulaFields("ToDate")
                If Not fld Is Nothing Then
                    fld.Text = "Date(" & dtpToDate.Value.Year & "," & dtpToDate.Value.Month & "," & dtpToDate.Value.Day & ")"
                    bRefresh = True
                End If
                SetTitleLine2(rpt, bRefresh)
            End If
        End If

        If Refresh And bRefresh Then
            If dtpToDate.Value <> CDate(dtpToDate.Tag) OrElse _
               dtpFromDate.Value <> CDate(dtpFromDate.Tag) Then
                System.Windows.Forms.Application.DoEvents()
                If CRV.Visible Then CRV.ReportSource = rpt ' The popup appears when this statement is executed.
                If CRV.Visible = True Then CRV.Refresh()
                dtpToDate.Tag = dtpToDate.Value
                dtpFromDate.Tag = dtpFromDate.Value
                Return True
            End If
        End If
    Catch ex As Exception
        DisplayException(ex)
    End Try
    Return False  
End Function

I also tried this technique recommended from another site - with no result - I still get the pop-up window:

CRV.ParameterFieldInfo.Clear()
If CRV.Visible Then CRV.ReportSource = rpt
1
Mate, your question is marked as Assumed Answered on the CR website with your comments "I no longer receive this error... ". If there something different in this question why dont you lay emphasis on the question rather than pointing viewers to a diff website that has marked the question as Answered. - aMazing
The poster of the original question says they have somehow fixed it, but did not post exactly how. My question is still unanswered here: scn.sap.com/message/14842389#14842389. Also, I have tried to clear the parameters, as mentioned above, but still get exactly the same error. Also, this worked fine under CR 2008 but stopped working under CR 2010. - Arkitec
Can you try executing the same statement that pops the error without passing any parameters or may be some hardcoded values for the sake of checking if its the parameters that causes the issue. Then you should be able to narrow it down. - aMazing

1 Answers

0
votes

Problem has been resolved. I downloaded Support Pack 8 (v.13.0.8.1216) from this location. I then applied the fix from the entry above:

With CRV ' Report Viewer Control
    If .Visible Then
        If .ParameterFieldInfo IsNot Nothing Then .ParameterFieldInfo.Clear()
        .ReportSource = rpt
        .Refresh()
    End If
End With

And no more annoying "No Error" messages.