刚刚接触水晶报表9.2 ,在vb里使用它,但很多地方不懂!请各位大侠帮帮忙!!!
我的代码是这样的,不知什么地方出错了
Private Sub Form_Load()Dim oApp As New CRAXDRT.Application
Dim oRpt As CRAXDRT.Report
Dim reportName As String
Dim StrTitle As StringStrTitle = "gggg"
Screen.MousePointer = vbHourglass
reportName = "\rpt\Pr2.rpt"Set oRpt = oApp.OpenReport(App.Path & reportName, 1)
'Title是报表的一个公式字段
oRpt.FormulaFields.GetItemByName("Title").Text = StrTitle oRpt.Database.SetDataSource rs
oRpt.ReadRecordsCRViewer91.ReportSource = oRptCRViewer91.ViewReport
Screen.MousePointer = vbDefault
End SubPrivate Sub Form_Resize()CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.Height = ScaleHeight
CRViewer91.Width = ScaleWidthEnd SubPrivate Sub Form_Unload(Cancel As Integer)
Set rs = Nothing
Set conn = Nothing
Unload Form2
End Sub
调试的时候出错,错误提示是怎么的“剩余文本不是公式的一部分”
究竟那里错了???
我的代码是这样的,不知什么地方出错了
Private Sub Form_Load()Dim oApp As New CRAXDRT.Application
Dim oRpt As CRAXDRT.Report
Dim reportName As String
Dim StrTitle As StringStrTitle = "gggg"
Screen.MousePointer = vbHourglass
reportName = "\rpt\Pr2.rpt"Set oRpt = oApp.OpenReport(App.Path & reportName, 1)
'Title是报表的一个公式字段
oRpt.FormulaFields.GetItemByName("Title").Text = StrTitle oRpt.Database.SetDataSource rs
oRpt.ReadRecordsCRViewer91.ReportSource = oRptCRViewer91.ViewReport
Screen.MousePointer = vbDefault
End SubPrivate Sub Form_Resize()CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.Height = ScaleHeight
CRViewer91.Width = ScaleWidthEnd SubPrivate Sub Form_Unload(Cancel As Integer)
Set rs = Nothing
Set conn = Nothing
Unload Form2
End Sub
调试的时候出错,错误提示是怎么的“剩余文本不是公式的一部分”
究竟那里错了???
解决方案 »
- API中函数,常量的声明一大堆,很乱,大家有什么好办法?
- 请vb朋友们和我一起挽留我的爱情,我太珍惜这份感情了了,谢谢大家
- 做过点阵的高手,请进!
- 谁能解决调用VB写的DLL发生异常问题
- 如何用vb编程实现用电脑通过网络给手机发短信
- 各位高手请进,,,,,,,,,,,,,
- 在vb上实现中文字符的比较!
- 关于 dataReport 打印网格的问题!
- 在vb 的编程中, 因为要连接到sql ,所以要在 工具箱中建立datagird 等控件
- 存储过程与函数有什么区别?什么是游标?游标有什么作用?
- 如何启用键盘上面的数字键盘
- "运行时出错‘-214702383(80070422):Automation错误"
Dim strPathName As String, strReportName As String, strSqlPath As String
Dim rsPath As New ADODB.Recordset
strSqlPath = "select mean from tab where parameter_name='tabOrderFormReport'"
rsPath.Open strSqlPath, strPubConnect, adOpenKeyset, adLockReadOnly
If Not rsPath.EOF Then
strPathName = rsPath.Fields(0).Value
Else
MsgBox "找不到報表路徑,請與資訊聯系!", vbCritical, "提醒您"
Exit Sub
End If
strReportName = "custom_tabMaterialGoinReport.rpt"
Screen.MousePointer = 11
Set objReport = objApp.OpenReport(strPathName & strReportName, 1)
' Set objReport = objApp.OpenReport("G:\Report\" & strReportName, 1)
objReport.Database.SetDataSource rsImport
objReport.ReadRecords
CRViewer91.ReportSource = objReport
CRViewer91.ViewReport
Screen.MousePointer = 0
End SubPrivate Sub Form_Resize()
CRViewer91.Top = 0
CRViewer91.Left = 0
CRViewer91.Height = ScaleHeight
CRViewer91.Width = ScaleWidth
End Sub