PDA

Click to See Complete Forum and Search --> : CRViewer9


slaird
Feb 25th, 2005, 08:20 AM
Using an Excel form, I put a CRViewer9 control on a form and viewed a specific Crystal report...no problem.

In the same instance of the Excel workbook and after the above mentioned form has been unloaded, I re-open the form and try to view the same report...it errors out on me.

Error: -2147417848

Any thoughts or ideas? I have not tried this in VB as of yet...just testing and learning.

Also, how do you close a view?...(the closeView method does not work.)

My code:

Dim CRXApplication As CRAXDDRT.Application
Dim CRXReport As CRAXDDRT.Report
Dim CRXDatabase As CRAXDDRT.Database
Dim strPath As String

On Error GoTo errorhandler

Set CRXApplication = New CRAXDDRT.Application
Set CRXReport = New CRAXDDRT.Report
Set CRXDatabase = CRXReport.Database

strPath = "Y:\USERS\tlawrence\Crystal DataWhse\Inventory\OpenInventory.rpt"
Set CRXReport = CRXApplication.OpenReport(strPath, 1)

cr.ReportSource = CRXReport
cr.ViewReport

Set CRXDatabase = Nothing
Set CRXReport = Nothing
Set CRXApplication = Nothing
Exit Sub

errorhandler:
MsgBox "" & Err.Number & " (" & Err.Description & ")."
Err.Clear

Thanks in advance.