筛选产品PD01在2012, 2013年每个月的数据
那么下面的代码如何更改
Dim Filter As String = ""
If e.node.Name <> "显示所有行" Then
Dim d1 As Date
Dim d2 As Date
Dim Year As Integer = e.Node.DataRow("年")
Dim Month As Integer = e.Node.DataRow("月")
Dim Product As String = 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
d1 = New Date(Year, Month, 1) '取得该月的第一天
d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) '取得该月的最后一天
Filter = "日期 >= #" & d1 & "# And 日期 <= #" & d2 & "# And 产品 = '" & Product & "'"
End Select
End If
Tables("订单").Filter = Filter