Hello all.
I'm trying to display a CRX report using the ActiveX report viewer. I call up the report via this code:
Code:
Option Explicit
Private m_sSourceFile As String
Private m_sSelectionFormula As String

'The SourceFile property should be passed as JUST the beginning of the filename. The rest will be derived by VB. In other words,
'"HPNotes" or "Smear".
Public Property Get SourceFile() As String

    SourceFile = m_sSourceFile

End Property

Public Property Let SourceFile(ByVal sSourceFile As String)

    'Trim the extension off the end if it's there
    sSourceFile = Replace(sSourceFile, ".rpt", "", , , vbTextCompare)
    'If 'Not US', then
    If notUS = True Then
        sSourceFile = sSourceFile & "NL"
    End If
    sSourceFile = sSourceFile & ".rpt"
    m_sSourceFile = sSourceFile
    RenderReport
    

End Property

Public Property Get SelectionFormula() As String

    SelectionFormula = m_sSelectionFormula

End Property

Public Property Let SelectionFormula(ByVal sSelectionFormula As String)

    m_sSelectionFormula = sSelectionFormula
    RenderReport
End Property

Private Sub RenderReport()
'The Crystal reports "application" to hold the report and control the viewer
Dim vl_CRApp_cra As CRAXDRT.Application
'The Crystal reports "report" containing the report itself and any changes
Dim vl_CRRep_cra As CRAXDRT.report


'Initialize objects
Set vl_CRApp_cra = New CRAXDRT.Application
Set vl_CRRep_cra = New CRAXDRT.report


'Ensure that parameters are entered and file exists
If (SourceFile <> vbNullString) And (SelectionFormula <> vbNullString) And (StrComp(Dir(SourceFile), SourceFile, vbTextCompare) = 0) Then
    
    'Open the report
    Set vl_CRRep_cra = vl_CRApp_cra.OpenReport(SourceFile)
    
    vl_CRRep_cra.RecordSelectionFormula = SelectionFormula
    
    'Set the selection formula on the report
    report.ReportSource = vl_CRRep_cra
    
    RefreshReport
End If

Set vl_CRApp_cra = Nothing
Set vl_CRRep_cra = Nothing

End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub RefreshReport()
report.ViewReport
report.Refresh

End Sub

Actually, that's all the code for the form. When I call that form from another form, passing the two properties ahead of time, the crystal report displays fine - no problem. But, then I close the crystal report and try to re-open it immediately after and I get the above message.
I thought that it had something to do with the variables in the crystal report viewer form, but it doesn't. When I hit debug on that error message again, then F5 (to begin execution) it works perfectly.
I began to think that it was simply working every other time the form was opened, so I get a breakpoint right before the line of code that set the reportsource property. When I hit F5 there, everything works.

So, ultimately, I need to pause execution of my program then resume it again in order for everything to work. I've tried this with both modal and modeless window modes for both the calling form and crystal report form, but that doesn't seem to help.

Does anyone have any ideas?