以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  请教老师:如何按指定日期时段进行筛选  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=99357)

--  作者:wakai
--  发布时间:2017/4/17 23:53:00
--  请教老师:如何按指定日期时段进行筛选
做一个进仓查询,需要按指定日期段筛先,比如从4-5至4-10的进仓明细
上个例子
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.foxdb


--  作者:有点蓝
--  发布时间:2017/4/18 10:27:00
--  
参考:http://www.foxtable.com/webhelp/scr/1058.htm
--  作者:2900819580
--  发布时间:2017/4/18 10:33:00
--  
Dim Filter As String
Tables("进仓明细").Filter = ""
With e.Form.Controls("商品ID")
    If .Value IsNot Nothing Then
        Filter ="商品ID Like \'%" & .Value & "%\'"
    End If
End With
With e.Form.Controls("名称")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "名称 Like \'%" & .Value & "%\'"
    End If
End With

Dim jz As WinForm.DateTimePicker = e.Form.Controls("截止日期")
Dim kc As WinForm.DateTimePicker = e.Form.Controls("开始日期")

If kc.Value IsNot Nothing Then
    If Filter > "" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "日期 > \'" & kc.Value & "\'"
End If

If jz.Value IsNot Nothing Then
    If Filter > "" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "日期 < \'" & jz.Value & "\'"
End If
MessageBox.Show(filter)
If Filter > "" Then
    Tables("进仓明细").Filter = Filter
End If