类文件
Option ExplicitPublic Sub ShowPrint(str As String) '图书查询的打印预览函数
On Error Resume Next
Dim mrc As Recordset '定义一个记录集
Dim txtsql As String
Dim msgtext As String
txtsql = str
Set mrc = New Recordset '实例一个记录集
Set mrc = ExecuteSQL(txtsql, msgtext)
'记录集的打开内容 是用户查询的内容
Dim rs_lab As Integer
Dim rs_txt As Integer
Dim num As Integer
rs_lab = 0
rs_txt = 0
'动态判断查询的内容,给报表的标签(rptlabel),文本框(rpttextbox)赋值
With DataReport1
' .DataMember = ""
Set .DataSource = mrc '设置报表的 datasource
.Hide
.DataMember = ""
With .Sections("section2").Controls '报表的页标题
For num = 1 To .Count
If TypeOf .Item(num) Is RptLabel Then
.Item(num).Caption = mrc.Fields(rs_lab + 1).Name & ":"
rs_lab = rs_lab + 1
End If
Next num
End With
With .Sections("section1").Controls '报表的细节部分
For num = 1 To .Count
If TypeOf .Item(num) Is RptTextBox Then
.Item(num).DataMember = ""
.Item(num).DataField = mrc(rs_txt).Name
rs_txt = rs_txt + 1
End If
Next num
End With
.Refresh
.Show
End With
End Sub
程序文件调用一个showprint(“select *from Customers”)
报表中的数据显示不了。
Option ExplicitPublic Sub ShowPrint(str As String) '图书查询的打印预览函数
On Error Resume Next
Dim mrc As Recordset '定义一个记录集
Dim txtsql As String
Dim msgtext As String
txtsql = str
Set mrc = New Recordset '实例一个记录集
Set mrc = ExecuteSQL(txtsql, msgtext)
'记录集的打开内容 是用户查询的内容
Dim rs_lab As Integer
Dim rs_txt As Integer
Dim num As Integer
rs_lab = 0
rs_txt = 0
'动态判断查询的内容,给报表的标签(rptlabel),文本框(rpttextbox)赋值
With DataReport1
' .DataMember = ""
Set .DataSource = mrc '设置报表的 datasource
.Hide
.DataMember = ""
With .Sections("section2").Controls '报表的页标题
For num = 1 To .Count
If TypeOf .Item(num) Is RptLabel Then
.Item(num).Caption = mrc.Fields(rs_lab + 1).Name & ":"
rs_lab = rs_lab + 1
End If
Next num
End With
With .Sections("section1").Controls '报表的细节部分
For num = 1 To .Count
If TypeOf .Item(num) Is RptTextBox Then
.Item(num).DataMember = ""
.Item(num).DataField = mrc(rs_txt).Name
rs_txt = rs_txt + 1
End If
Next num
End With
.Refresh
.Show
End With
End Sub
程序文件调用一个showprint(“select *from Customers”)
报表中的数据显示不了。
解决方案 »
- 我要用vb提交数据到sql数据库,请问如何做,诚求各位帮我一下
- 条形码输入的问题
- 请教:API的哪个函数能获取用户登录windows操作系统的用户名信息呢?
- 怎样动态生成rpttext?
- 数据不能升级,为什么???
- 请问谁有VB写的五子棋源程序?急
- 帮忙我翻译一下这代码的注释
- 小弟向大哥大姐们请教VB数据库问题!
- 如何将VB程序生成若干的DLL文件,为以后维护作准备?
- 那位大侠能告诉俺交叉表查询中Transform...pivot...的用法,最好能详细些,有例子就更好了
- 编译时报错:procedure declaration does not match description of event or procedure having the same name
- 如何设置应用程序图标
然后调用showprint(“select *from Customers”)