Foxtable(狐表)用户栏目专家坐堂 → [求助]筛选两个时间段内的代码


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

主题:[求助]筛选两个时间段内的代码

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/22 10:59:00 [显示全部帖子]

Dim t1 As Date
Dim t2 As Date

Tables("表A").Filter = "案发时间 >= #" & t1 & "# and 案发时间 <= #" & t2 & "#"


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/22 11:08:00 [显示全部帖子]

Dim Filter As String = "1=1"
With e.Form.Controls("TextBox8")
    If .Value IsNot Nothing Then
        Filter &= " and 编号 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("TextBox7")
    If .Value IsNot Nothing Then
        Filter &= " and 车辆基本情况_车牌号码 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("ComboBox5")
    If .Value IsNot Nothing Then
        Filter &= " and 车辆基本情况_车牌颜色 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("ComboBox6")
    If .Value IsNot Nothing Then
        Filter &= " and 案件状态 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("DateTimePicker2")
    If .Value IsNot Nothing Then
        Filter &= " and 违章基本情况_违章时间 >= '" & .Value & "'"
    End If
End With
With e.Form.Controls("DateTimePicker3")
    If .Value IsNot Nothing Then
        Filter &= " and 违章基本情况_违章时间 <= '" & .Value & "'"
    End If
End With
If Filter > "" Then
    Tables("车辆违章表").Filter = Filter
End If

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2014/7/22 11:49:00 [显示全部帖子]

看5楼。

 回到顶部