查询按钮代码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 & "#"
End If
End With
With e.Form.Controls("DateTimePicker2")
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
Tables("日报表_Table2").Filter = Filter
Tables("日报表_Table3").Filter = Filter
Tables("日报表_Table4").Filter = Filter
End If
If Filter > "" Then
Tables("日报表_Table1").DataTable.loadFilter = Filter
Tables("日报表_Table1").DataTable.load
Tables("日报表_Table2").DataTable.loadFilter = Filter
Tables("日报表_Table2").DataTable.load
Tables("日报表_Table3").DataTable.loadFilter = Filter
Tables("日报表_Table3").DataTable.load
Tables("日报表_Table4").DataTable.loadFilter = Filter
Tables("日报表_Table4").DataTable.load
End If
导出EXCEL代码
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()
[此贴子已经被作者于2013-7-28 22:40:00编辑过]