Foxtable(狐表)用户栏目专家坐堂 → 按照日期筛选的问题


  共有8210人关注过本帖树形打印复制链接

主题:按照日期筛选的问题

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


加好友 发短信
等级:管理员 帖子:47448 积分:251054 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2012/6/14 16:12:00 [显示全部帖子]

取得这个月的第一天和最后一天,然后进行筛选:

 

Dim Filter As String
With e.Form.Controls("Time")
    If .Value IsNot Nothing Then
        Dim dt As Date = .value
        Dim dt1 As Date = new Date(dt.year,dt.month,1)
        Dim dt2 As Date = dt1.AddMonths(1).AddDays(-1)
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "rq >= #" & dt1 & "# And rq <= #" & dt2 & "#"
    End If
End With


 回到顶部