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 had two queries:-
(a) I am getting an error report on line marked (1) that " Subscript beyond Range". I am not able to find a solution. when "MyReport.rpt" is already connected to a database and is configured, I am getting a report, but when a new blank report is used in its palce, I am not getting any result. Can anyone please tell me how to proceed ?


(2) If the report is automatically placed in the form by the VB, can I get a report? If so, can anyone give me a sample code?

thanks in advance,
GeoNav