Foxtable(狐表)用户栏目专家坐堂 → 筛选统计问题


  共有3027人关注过本帖平板打印复制链接

主题:筛选统计问题

帅哥哟,离线,有人找我吗?
qazlinle6
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:七尾狐 帖子:1553 积分:10495 威望:0 精华:0 注册:2013/6/8 16:19:00
筛选统计问题  发帖心情 Post By:2020/10/29 23:45:00 [只看该作者]

Dim Filter As String = ""
If e.Node.Name <> "显示所有行" Then '要用Name属性,不能用Text属性
    Dim d1 As Date
    Dim d2 As Date
    Dim d3 As Date
    Dim Year As Integer = e.Node.DataRow("年")
    Dim Month As Integer = e.Node.DataRow("月")
    Dim Day As Integer = e.Node.DataRow("日")
    Dim a1 As String = e.Node.DataRow("商品备注")
    Dim a2 As String = e.Node.DataRow("是否可用")
    
    Select Case e.Node.Level
        Case 0
            d1 = New Date(Year,1,1) '取得该年的第一天
            d2 = new Date(Year,12,31) '取得该年的最后一天
            d3 = new Date(Year,1,31) '取得该年的最后一天
            Filter ="登记时间 >= #" & d1 & "# And 登记时间 <= #" & d2 & "# And 登记时间 <= #" & d3 & "#"
        Case 1
            d1 = New Date(Year, Month, 1) '取得该月的第一天
            d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) '取得该月的最后一天
            d3 = new Date(Year, Month, Day, Date.DaysInMonth(Year,Month,Day)) '取得该月的最后一天
            Filter ="登记时间 >= #" & d1 & "# And 登记时间 <= #" & d2 & "# And 登记时间 <= #" & d3 & "#"
        Case 2  
            d1 = New Date(Year, Month, 1) '取得该月的第一天
            d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) '取得该月的最后一天
            d3 = new Date(Year, Month,Day, Date.DaysInMonth(Year,Month,Day)) '取得该月的最后一天
            Filter ="登记时间 >= #" & d1 & "# And 登记时间 <= #" & d2 & "# And 登记时间 <= #" & d3 & "#"
        Case 3

            d1 = New Date(Year, Month, 1) '取得该月的第一天
            d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) '取得该月的最后一天
            d3 = new Date(Year, Month,Day, Date.DaysInMonth(Year,Month,Day)) '取得该月的最后一天
            Filter ="登记时间 >= #" & d1 & "# And 登记时间 <= #" & d2 & "# And 登记时间 <= #" & d3 & "# And 商品备注 = '" & a1 & "'"
        Case 4
            d1 = New Date(Year, Month, 1) '取得该月的第一天
            d2 = new Date(Year, Month, Date.DaysInMonth(Year,Month)) '取得该月的最后一天
            d3 = new Date(Year, Month,Day, Date.DaysInMonth(Year,Month,Day)) '取得该月的最后一天
            Filter ="登记时间 >= #" & d1 & "# And 登记时间 <= #" & d2 & "# And 登记时间 <= #" & d3 & "# And 商品备注 = '" & a1 & " And 是否可用 = '" & a2 & "'"
    End Select
End If
Tables("FRID标签").Filter = Filter

哪有问題吗

 回到顶部