Dim Filter As String = ""
If e.node.Name <> "显示所有行" Then
Dim d1 As Date
Dim d2 As Date
Dim Year As Integer = CInt(e.Node.DataRow("年"))
Dim Month As Integer =CInt(e.Node.DataRow("月"))
Dim d3 As Date = CDate(e.Node.DataRow("日"))
Select Case e.Node.Level
Case 0
d1 = New Date(Year,1,1) '取得该年的第一天
d2 = new Date(Year,12,31) '取得该年的最后一天
Filter = "计划日期 >= '" & d1 & "' And 计划日期 <= '" & d2 & "'"
Case 1
d1 = New Date(Year, Month, 1) '取得该月的第一天
d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) '取得该月的最后一天
Filter = "计划日期 >= '" & d1 & "' And 计划日期 <= '" & d2 & "'"
Case 2
Filter = "计划日期 = '" & d3 & "'"
End Select
End If
MessageBox.show(Filter)
With DataTables("成品日计划")
.LoadFilter = Filter '设置加载条件
.LoadPage = 0 '加载第一页
.LoadTop = 20 '每页20行
.Load()
e.Form.Controls("TextBox1").Value = 1 & "/" & .TotalPages
End With
[此贴子已经被作者于2015/6/24 16:26:30编辑过]