[求助]在一个窗口点击一个筛选按钮筛选控件副本表后,在点击Excel报表按钮输出时,如果不先点击一下控件表,报表就会输出筛选前的内容?是哪里有问题?
我的筛选按钮代码是:
Dim Filter As String
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
Filter = "申购单位 = '" & .Value & "'"
End If
End With
With e.Form.Controls("ComboBox2")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "货物类别 = '" & .Value & "'"
End If
End With
With e.Form.Controls("StartDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "操作日期 >= #" & .Value & "#"
End If
End With
With e.Form.Controls("EndDate")
If .Value IsNot Nothing Then
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "操作日期 <= #" & .Value & "#"
End If
End With
If Filter > "" Then
Tables("染料助剂明细查询_Table1").Filter = Filter
End If
报表输出代码是:
Dim Book As New XLS.Book(ProjectPath & "Attachments\染化料助剂领料报表.xls")
Dim fl As String = ProjectPath & "Reports\染化料助剂领料报表.xls"
Book.Build() '生成细节区
Book.Save(fl) '保存工作簿
Dim Proc As New Process '打开工作簿
Proc.File = fl
Proc.Start()
请哪位老师帮忙看看!