Dear balves:
I have create a Crystal Report "CrystalReport6.rpt" with the Active Data Driver, but the report data couldn't be shown , the SetDataSource method seems doesn't work, could you kindly help me?
my system: win2000, crystal report 7.0, vb 6.0
thanks!
bob
Private Sub Command1_Click()
Dim OleDbConnection1 As New ADODB.Connection
Dim Recordset1 As New ADODB.Recordset
Dim Recordset2 As New ADODB.Recordset
Dim app1 As New CRAXDRT.Application
Dim Report As CRAXDRT.Report
Set Report = app1.OpenReport("D:\tmp\CrystalReport6.rpt"
OleDbConnection1.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\tmp\LocalAccess.mdb"

Recordset1.Open "SELECT product_id,brand_name,product_name FROM product where product_id>25 and product_id<30", OleDbConnection1, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly
Report.DiscardSavedData
Report.Database.Tables(1).SetDataSource Recordset1
' Report.Database.Tables(1).SetPrivateData 3, Recordset1
' Report.Database.Tables.Item(1).SetPrivateData 3, Recordset1
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
End Sub