I am trying to use an existing .RPT file from within the Report Designer Component in VB6. The code I'm using is code I've seen in multiple places (books, forums, etc.) yet it does not work. I get an error message back saying "Server has not yet been opened."
According to the Crystal Reports Support site, this error is caused by an invalid database connection. I already have a database connection opened and used by the time I get to the report, and the report itself has all (?) of the connection info. The report was created using Crystal Reports Developer 8.5.
I've tried creating another connection from within the form, but without success.
Here is my current code:
VB Code:
Dim Application As CRAXDRT.Application Dim Report As CRAXDRT.Report Private Sub Form_Load() Screen.MousePointer = vbHourglass Set Application = CreateObject("CrystalRuntime.Application") Set Report = Application.OpenReport(App.Path & "\reports\ticketless.rpt") CRViewer1.ReportSource = Report CRViewer1.ViewReport Screen.MousePointer = vbDefault End Sub Private Sub Form_Resize() CRViewer1.Top = 0 CRViewer1.Left = 0 CRViewer1.Height = ScaleHeight CRViewer1.Width = ScaleWidth End Sub
Any help is greatly appreciated! Thanks




Reply With Quote