GeoNav
September 11th, 2006, 10:30 PM
Hi,
I am using VB6.0 , Access 2000,abd CR 8.0.
I am using the following code.
'Add reference to Crystal Reports x.x ActiveX Designer RunTime Library
'Add component Crystal Reports Viewer Control
'Add reference to Microsoft ActiveX Data Objects 2.8 Library
'oCnn = current open ADO connection object
Private Sub Command1_Click()
Dim oApp As CRAXDRT.Application
Dim oReport As CRAXDRT.Report
Dim oRs As ADODB.Recordset
Dim sSQL As String
sSQL = "SELECT * FROM Table1"
Set oRs = New ADODB.Recordset
Set oRs = oCnn.Execute(sSQL)
Set oApp = New CRAXDRT.Application
Set oReport = oApp.OpenReport(App.Path & "\MyReport.rpt", 1)
(1) oReport.Database.SetDataSource oRs, 3, 1
crvMyCRViewer.ReportSource = oReport
crvMyCRViewer.ViewReport
End Sub
I am getting an error report on line marked (1) that " Subscript beyond Range". I assume that this is due to declaration of oRs as Recordsat and the value required in place of oRs in the same line is "data".
I am not able to find a solution.
Can anyone please tell me how to proceed ?
Thank You,
GeoNav
I am using VB6.0 , Access 2000,abd CR 8.0.
I am using the following code.
'Add reference to Crystal Reports x.x ActiveX Designer RunTime Library
'Add component Crystal Reports Viewer Control
'Add reference to Microsoft ActiveX Data Objects 2.8 Library
'oCnn = current open ADO connection object
Private Sub Command1_Click()
Dim oApp As CRAXDRT.Application
Dim oReport As CRAXDRT.Report
Dim oRs As ADODB.Recordset
Dim sSQL As String
sSQL = "SELECT * FROM Table1"
Set oRs = New ADODB.Recordset
Set oRs = oCnn.Execute(sSQL)
Set oApp = New CRAXDRT.Application
Set oReport = oApp.OpenReport(App.Path & "\MyReport.rpt", 1)
(1) oReport.Database.SetDataSource oRs, 3, 1
crvMyCRViewer.ReportSource = oReport
crvMyCRViewer.ViewReport
End Sub
I am getting an error report on line marked (1) that " Subscript beyond Range". I assume that this is due to declaration of oRs as Recordsat and the value required in place of oRs in the same line is "data".
I am not able to find a solution.
Can anyone please tell me how to proceed ?
Thank You,
GeoNav