Results 1 to 3 of 3

Thread: CRX Viewer error code 0xbe4

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2007
    Location
    Middletown, CT
    Posts
    948

    CRX Viewer error code 0xbe4

    Hello.
    I'm trying to open a Crystal Report that was originally made in CR5 in a CRX viewer. I plan to port all reports into CRX, so I wanted to use the CRX viewer instead of the CR5 one.

    I'm getting this message when I try to open my report:
    Name:  3-20-2009 11-57-45 AM.jpg
Views: 574
Size:  35.6 KB

    I'm using the following code to render the report:
    vb Code:
    1. Private Sub RenderReport()
    2. 'The Crystal Reports "application" to hold the CRReport and control the viewer
    3. Dim vl_CRApp_cra As CRAXDRT.Application
    4. 'The Crystal Reports "CRReport" containing the CRReport itself and any changes
    5. Dim vl_CRRep_cra As CRAXDRT.Report
    6.  
    7.  
    8. 'Initialize objects
    9.    'On Error GoTo RenderReport_Error
    10.    Stack.Push "RenderReport"
    11.  
    12. Set vl_CRApp_cra = New CRAXDRT.Application
    13. Set vl_CRRep_cra = New CRAXDRT.Report
    14.  
    15.  
    16. 'Ensure that parameters are entered and file exists
    17. If (SourceFile <> vbNullString) And (Dir(SourceFile) <> vbNullString) Then
    18.    
    19.     'Open the CRReport
    20.     Set vl_CRRep_cra = vl_CRApp_cra.OpenReport(SourceFile)
    21.    
    22.     vl_CRRep_cra.RecordSelectionFormula = SelectionFormula
    23.     vl_CRRep_cra.DiscardSavedData
    24.     vl_CRRep_cra.Database.SetDataSource DataSource
    25.    
    26.    
    27.    
    28.     'Set the selection formula on the CRReport
    29.     CRReport.ReportSource = vl_CRRep_cra
    30.    
    31.    
    32.     RefreshReport
    33. Else
    34.     MsgBox "Invalid parameters"
    35. End If
    36.  
    37. Set vl_CRApp_cra = Nothing
    38. Set vl_CRRep_cra = Nothing
    39.  
    40.  
    41. CleanUp:
    42.    On Error GoTo 0
    43.    Stack.Pop
    44.    Exit Sub
    45.  
    46. RenderReport_Error:
    47.  
    48. ErrHandler "frmCRX", "Form", "Sub", "RenderReport", Erl
    49.  
    50. End Sub

    My thought is that perhaps I'm not setting the report's database location properly. I assume I'm supposed to be using SetDataSource - since it makes sense that the report would want to pull info straight from a recordset.
    Is there another property in which I would specify a database file name? I'm a n3wb to the CRX SDK.

  2. #2
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,886

    Re: CRX Viewer error code 0xbe4

    Here's an example about how to render a .rpt file with subreports using Crystal Reports X
    The report was designed to read a MS Access database file using DAO

    Code:
    'General Declarations
    Public CRApplication As New CRAXDRT.Application
    Public CRReport      As New CRAXDRT.Report
    Public CRConProp     As CRAXDRT.ConnectionProperty
    Public CRTabla       As CRAXDRT.DatabaseTable
    Public CRFormula     As CRAXDRT.FormulaFieldDefinition
    Public CRSections    As CRAXDRT.Sections
    Public CRSection     As CRAXDRT.Section
    Public CRSubRpt      As CRAXDRT.Report
    Public CRSubRptObj   As CRAXDRT.SubreportObject
    Public CRRptObjs     As CRAXDRT.ReportObjects
    Public CRField       As CRAXDRT.DatabaseFieldDefinition
    Public ReportObject  As Object
    
    Public GTituloA      As String  'Main title
    Public GTituloB      As String  'Subtitle
    Public GSelFor       As String  'Selection formula string
    Public MEnt2	     As Integer 'a counter
    
    'Preview the report
    	GTituloA = "Main Title"
            GSelFor = "{Ingresos.FechaIng} = Date(" & MHasta & ")"
            
            Set CRReport = CRApplication.OpenReport(MyPath & "\rdi.rpt", 1)
            For MEnt2 = 1 To CRReport.Database.Tables.Count
                Set CRTabla = CRReport.Database.Tables(MEnt2)
                Set CRConProp = CRTabla.ConnectionProperties("Database Type")
                    CRConProp.value = "Access/Excel (DAO)"
                Set CRConProp = CRTabla.ConnectionProperties("Database Name")
                    CRConProp.value = MyPath & "\Ingresos.mdb"
                Set CRConProp = CRTabla.ConnectionProperties("Database Type")
                    CRConProp.value = "Access"
                Set CRConProp = CRTabla.ConnectionProperties("Session UserID")
                    CRConProp.value = ""
            Next MEnt2
    	'
            For MEnt2 = 1 To CRReport.FormulaFields.Count
                Select Case CRReport.FormulaFields(MEnt2).name
                    Case "{@a}"
                        CRReport.FormulaFields(MEnt2).Text = "Trim(" & Chr(39) & "Company's Name" & Chr(39) & ")"
                    Case "{@b}"
                        CRReport.FormulaFields(MEnt2).Text = "Trim(" & Chr(39) & GTituloA & Chr(39) & ")"
                    Case "{@c}"
                        CRReport.FormulaFields(MEnt2).Text = "Trim(" & Chr(39) & GTituloB & Chr(39) & ")"
                End Select
            Next MEnt2
    
            If Trim(GSelFor) <> "" Then
                CRReport.RecordSelectionFormula = GSelFor
            End If
            
            Set CRSections = CRReport.Sections
            For Each CRSection In CRSections
                Set CRRptObjs = CRSection.ReportObjects
                For Each ReportObject In CRRptObjs
                    If ReportObject.Kind = CRAXDRT.CRObjectKind.crSubreportObject Then
                        Set CRSubRptObj = ReportObject
                        Set CRSubRpt = CRSubRptObj.OpenSubreport
                        For MEnt2 = 1 To CRSubRpt.Database.Tables.Count
                            Set CRTabla = CRSubRpt.Database.Tables(MEnt2)
                            Set CRConProp = CRTabla.ConnectionProperties("Database Type")
                                CRConProp.value = "Access/Excel (DAO)"
                            Set CRConProp = CRTabla.ConnectionProperties("Database Name")
                                CRConProp.value = App.Path & "\IngresosU.Mdb"
                            Set CRConProp = CRTabla.ConnectionProperties("Database Type")
                                CRConProp.value = "Access"
                            Set CRConProp = CRTabla.ConnectionProperties("Session UserID")
                                CRConProp.value = ""
                        Next MEnt2
                    End If
                Next ReportObject
            Next CRSection
            
    	'Here show the form with the viewer
            frmReporte.Show vbModal
            
            Set CRSections = Nothing
            Set CRSection = Nothing
            Set CRSubRpt = Nothing
            Set CRSubRptObj = Nothing
            Set CRRptObjs = Nothing
            Set ReportObject = Nothing

    Now in the form with the viewer
    Code:
    Private Sub Form_Load()
    
        Me.Caption = GTituloA
        CRViewer1.ReportSource = CRReport
        CRViewer1.Zoom 1
        CRViewer1.ViewReport    
    
    End Sub
    
    
    
    Private Sub Form_Unload(Cancel As Integer)
    
        Set CRTabla = Nothing
        Set CRConProp = Nothing
        Set CRReport = Nothing
        Set CRApplication = Nothing
        GTituloA = ""
        GTituloB = ""
        GSelFor = ""
        
    End Sub

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jan 2007
    Location
    Middletown, CT
    Posts
    948

    Re: CRX Viewer error code 0xbe4

    Yeah..so....updating a CR5 report to CRX helps with the programmatic interaction.....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width