以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]求解数据筛选,报表打印代码?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=115109)

--  作者:老鼠
--  发布时间:2018/3/1 10:41:00
--  [求助]求解数据筛选,报表打印代码?

Dim nd As String = e.Form.Controls("ComboBox1").Text
Dim sd As String = e.Form.Controls("ComboBox2").Text
Dim str As String = "-1,"
str &= DataTables("生存认证资料").GetComboListString(“姓名" and "公民身份号码", "认证年度 = \'" & nd & "\'" Or "认证时段 = \'" & sd & "\'").replace("|", ",")
Tables("退休生存人员").filter = "_Identify in (" & str.trim(",") & ")"
\'==========================以上是筛选已经认证的人员==============================
Dim Book As New XLS.Book(ProjectPath & "Attachments\\退休认证表.xls")
Book.Build()
Book.Save(ProjectPath & "Reports\\退休认证表.xls")
Dim Proc As New Process
Proc.File = ProjectPath & "Reports\\退休认证表.xls"
Proc.Start()
\'==============================以上是认证报表打印=================================
Tables("退休生存人员").Filter = ""
e.Form.Close

 

 

以上是我自己弄的代码,但报错;主要问题出现在数据筛选上。其它是否还有问题还不清楚。请各位老师帮忙纠正下。此代码是用于[按钮]。

[此贴子已经被作者于2018/3/1 10:41:12编辑过]

--  作者:有点甜
--  发布时间:2018/3/1 11:09:00
--  

Dim nd As String = e.Form.Controls("ComboBox1").Text
Dim sd As String = e.Form.Controls("ComboBox2").Text
Dim str As String = ""
str &= DataTables("生存认证资料").GetComboListString("公民身份号码", "认证年度 = \'" & nd & "\' Or 认证时段 = \'" & sd & "\'").replace("|", "\',\'")
Tables("退休生存人员").filter = "公民身份号码 in (\'" & str.trim(",") & "\')"

\'==========================以上是筛选已经认证的人员==============================
Dim Book As New XLS.Book(ProjectPath & "Attachments\\退休认证表.xls")
Book.Build()
Book.Save(ProjectPath & "Reports\\退休认证表.xls")
Dim Proc As New Process
Proc.File = ProjectPath & "Reports\\退休认证表.xls"
Proc.Start()
\'==============================以上是认证报表打印=================================
Tables("退休生存人员").Filter = ""
e.Form.Close