Foxtable(狐表)用户栏目专家坐堂 → 如何对时间段进行筛选,谢谢


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

主题:如何对时间段进行筛选,谢谢

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/11/26 19:30:00 [只看该作者]

 你的时间列没有日期,是不能体现次日的情况。

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  12楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/11/26 19:47:00 [只看该作者]

Dim txt1 As String = e.Form.Controls("StartDate").Text
Dim txt2 As String = e.Form.Controls("EndDate").text
Dim cbx As Boolean = iif(txt1>txt2, True, False)

Dim filter As String
If cbx Then
    filter = "1=2"
    If txt1 <> Nothing Then
        Dim sd As Date = txt1
        filter &= " or 起始时间 >= #" & new Date(1900,1,1,sd.Hour,sd.Minute,sd.Second) & "#" 'Convert(起始时间,'System.String')
    End If
    If txt2 <> Nothing Then
        Dim sd As Date = txt2
        filter &= " or 起始时间 >= #" & new Date(1900,1,1,0,0,0) & "# and 起始时间 <= #" & new Date(1900,1,1,sd.Hour,sd.Minute,sd.Second) & "#" 'Convert(起始时间,'System.String')
    End If
   
Else
    filter = "1=1"
    If txt1 <> Nothing Then
        Dim sd As Date = txt1
        filter &= " and 起始时间 >= #" & new Date(1900,1,1,sd.Hour,sd.Minute,sd.Second) & "#" 'Convert(起始时间,'System.String')
    End If
    If txt2 <> Nothing Then
        Dim sd As Date = txt2
        filter &= " and 起始时间 <= #" & new Date(1900,1,1,sd.Hour,sd.Minute,sd.Second) & "#" 'Convert(起始时间,'System.String')
    End If
End If

e.Form.Controls("Table1").Table.Filter = filter


 回到顶部
总数 12 上一页 1 2