Hi all.
I've got a program that I'm trying to connect to a pre-built Crystal Report.
I'm using the CRViewer object.
I'm referenceing the 'Crystal Report Viewer Control'
& 'Crystal Reports 8.5 ActiveX Designer Runtime Library'
I'm trying to use a query to feed the report because the LogOnServer method seems twitchy and I would like to feed a variable to the query.
The report is prebuilt so I copied the query out of the Database->Show SQL Query menu... and used that in the program. I got the expected recordset. Now I need to feed that recordSet to the CRViewer. This happens..
It asks for a parameter that I gave it in the query and then tries to log on to the database which produces the error ..Server has not yet been opened....
I don't need it to do this because I already have the recordset. What do I need to do to get the report to use the query instead of trying to log on to the server?
Some setting in the pre-built report? Some method of CRViewer I missed? The code is below if you are interested.
Thanks everyone.
PB
CODE
'////////////////////////////////////////////
Public Appn As CRAXDRT.Application
Public cReport As CRAXDRT.Report
Private Sub Command1_Click()
'Get recordSet
Dim objCmd As ADODB.Command
Dim objRec As ADODB.Recordset
'Yada yada yada get the recordset code
'...I debug print the recordset so
'...I know it works
'/////////////////////////////////////
'Report
Set Appn = CreateObject("CrystalRunTime.Application"
'sets the pre-constructed report path
Set cReport = Appn.OpenReport("C:\Program Files\Display Board\PmWorkOrder.rpt"
cReport.DiscardSavedData
cReport.Database.SetDataSource objRec
CRViewer1.ReportSource = cReport
CRViewer1.ViewReport
End Sub
I've got a program that I'm trying to connect to a pre-built Crystal Report.
I'm using the CRViewer object.
I'm referenceing the 'Crystal Report Viewer Control'
& 'Crystal Reports 8.5 ActiveX Designer Runtime Library'
I'm trying to use a query to feed the report because the LogOnServer method seems twitchy and I would like to feed a variable to the query.
The report is prebuilt so I copied the query out of the Database->Show SQL Query menu... and used that in the program. I got the expected recordset. Now I need to feed that recordSet to the CRViewer. This happens..
It asks for a parameter that I gave it in the query and then tries to log on to the database which produces the error ..Server has not yet been opened....
I don't need it to do this because I already have the recordset. What do I need to do to get the report to use the query instead of trying to log on to the server?
Some setting in the pre-built report? Some method of CRViewer I missed? The code is below if you are interested.
Thanks everyone.
PB
CODE
'////////////////////////////////////////////
Public Appn As CRAXDRT.Application
Public cReport As CRAXDRT.Report
Private Sub Command1_Click()
'Get recordSet
Dim objCmd As ADODB.Command
Dim objRec As ADODB.Recordset
'Yada yada yada get the recordset code
'...I debug print the recordset so
'...I know it works
'/////////////////////////////////////
'Report
Set Appn = CreateObject("CrystalRunTime.Application"
'sets the pre-constructed report path
Set cReport = Appn.OpenReport("C:\Program Files\Display Board\PmWorkOrder.rpt"
cReport.DiscardSavedData
cReport.Database.SetDataSource objRec
CRViewer1.ReportSource = cReport
CRViewer1.ViewReport
End Sub