请问下,下面代码总是筛选全部数据,怎么修改成按照筛选条件筛选呢? Dim Book As New XLS.Book(ProjectPath & "Attachments\报价表.xls") '打开模板 Dim fl As String = ProjectPath & "Reports\报价表.xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim Filter As String With e.Form.Controls("DateTimePicker1") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "报价日期 = '" & .Value & "'" 'Filter = Filter & "报价日期 = #" & .Value & "#" '如果是内部表 End If End With With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "旺旺QQ = '" & .Value & "'" End If End With
If filter > "" Then Sheet(1,13).Value = "<" & filter & ">" Else Sheet(1,13).Value = "<all>" End If Book.Build() '生成报表 Book.Save(fl) Dim Proc As New Process Proc.File = fl Proc.Start()
|