Dim CrAppl As New CRAXDRT.Application
Dim CrRep As New CRAXDRT.Report
Private Sub Form_Load()
On Error GoTo err
dim cn as adodb.connection
dim rssql as adodb.recordset
dim strsql as string
Dim strPath As String
strsql="select * from pubs" ---你的SQL语句
If Right(App.Path, 1) = "\" Then
strPath = App.Path & "adorsout.rpt"
Else
strPath = App.Path + "\adorsout.rpt"
End If
set rssql=new adodb.recordset
rssql.open strsql
Set CrRep = CrAppl.OpenReport(strPath)
CrRep.Database.Tables(1).SetDataSource rssql, 3