Foxtable(狐表)用户栏目专家坐堂 → 按时间筛选问题


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

主题:按时间筛选问题

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


加好友 发短信
等级:小狐 帖子:349 积分:3329 威望:0 精华:0 注册:2016/3/8 18:13:00
按时间筛选问题  发帖心情 Post By:2018/8/10 11:57:00 [只看该作者]

老师,我有两个textbox框,两个datetimepicker框,进行筛选。

Dim sf As WinForm.TextBox = e.Form.Controls("按地区查询")
Dim dwmc As WinForm.TextBox = e.Form.Controls("按单位查询")
Dim ksrq As WinForm.DateTimePicker = e.Form.Controls("起始日期")
Dim jsrq As WinForm.DateTimePicker = e.Form.Controls("结束日期")
If sf.Value IsNot Nothing Then
    Tables("查询窗口_查询").Filter = "省份 Like '*" & sf.text & "*'"
End If
If dwmc.Value IsNot Nothing Then
    Tables("查询窗口_查询").Filter = "单位名称 Like '*" & dwmc.text & "*'"
End If
Dim Filter As String
If ksrq.Value IsNot Nothing Then
    If Filter > "" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "日期 >= '" & ksrq.Value.Date & "'"
End If

If jsrq.Value IsNot Nothing Then
    If Filter > "" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "日期 < '" & jsrq.Value.Date.adddays(1) & "'"
End If

按开始和结束时间查询无动作,请问是代码哪里的问题。textbox的查询正常
[此贴子已经被作者于2018/8/10 12:02:44编辑过]

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


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


Dim sf As WinForm.TextBox = e.Form.Controls("按地区查询")
Dim dwmc As WinForm.TextBox = e.Form.Controls("按单位查询")
Dim ksrq As WinForm.DateTimePicker = e.Form.Controls("起始日期")
Dim jsrq As WinForm.DateTimePicker = e.Form.Controls("结束日期")
Dim Filter As String = "1=1"
If sf.Value IsNot Nothing Then
    Filter &= " and 省份 Like '%" & sf.text & "%'"
End If
If dwmc.Value IsNot Nothing Then
    Filter &= " and 单位名称 Like '%" & dwmc.text & "%'"
End If

If ksrq.Value IsNot Nothing Then
    Filter = Filter & " and 日期 >= #" & ksrq.Value.Date & "#"
End If

If jsrq.Value IsNot Nothing Then
    Filter = Filter & " and 日期 < #" & jsrq.Value.Date.adddays(1) & "#"
End If

Tables("查询窗口_查询").Filter = filter


 回到顶部