自立更生,搞定了,我的代码如下
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Set CrReport = Appl.OpenReport(App.Path & "\rpt_FB0020.rpt") 'Open the Events.rpt report file.
With cnn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open "D:\work\医師\source\wmdb\KAIINMDB.mdb"
End With
Call rst.Open("FB0020", cnn, adOpenDynamic, adLockReadOnly, adCmdTable)
CrReport.ParameterFields(1).AddCurrentValue "abd"
CrReport.Database.SetDataSource rst
CRViewer91.ReportSource = CrReport 'Sets the Report source of the CrViewer to the Report object we created.
Dim moxReport As CRAXDRT.Report
Dim moxAplication As CRAXDRT.Application
Dim moxData As CRAXDRT.DatabaseTable
Set moxAplication = New CRAXDRT.Application
Set moxReport = moxAplication.OpenReport("E:\jyc040e.rpt")
Call moxReport.DiscardSavedData
For Each moxData In moxReport.Database.Tables
Call moxData.SetLogOnInfo("aplite2", "", "ct00", "nec")
Next
'SQL
moxReport.SQLQueryString = "select * from V_JYC040E WHERE ZYUCHUYMD>='20011101' AND ZYUCHUYMD<'20011201'"
CRViewer1.ReportSource = moxReport
CRViewer1.ViewReport
CRViewer1.Zoom (100)
Set moxAplication = Nothing