Foxtable(狐表)用户栏目专家坐堂 → 查询问题


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

主题:查询问题

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


加好友 发短信
等级:幼狐 帖子:92 积分:824 威望:0 精华:0 注册:2017/11/23 8:55:00
查询问题  发帖心情 Post By:2018/8/14 8:52:00 [只看该作者]

选择“下次检定日期”查询时排除“运维状态”列是"检定"的行。。。这个代码不知怎么写了,请老师指教。

Dim Val As WinForm.ComboBox = e.Form.Controls("boBoox")

Dim tex As WinForm.TextBox = e.Form.Controls("TexFind")

Dim str As String = tex.text

Dim stm As String = Val.Value

Dim Index As Integer

Dim ksrq As WinForm.DateTimePicker = e.Form.Controls("StartDate")

Dim jsrq As WinForm.DateTimePicker = e.Form.Controls("EndDate")

Dim Filter As String = "1=1"

Select Case stm

    Case "器具名称"

        Tables("杭康设备总表").filter = "器具名称 like'*" & str & "*'"

        ksrq.Value = Nothing

        jsrq.Value = Nothing

    Case "原编号"

        Tables("杭康设备总表").filter = "原编号 like'*" & str & "*'"

        ksrq.Value = Nothing

        jsrq.Value = Nothing

    Case "型号规格"

        Tables("杭康设备总表").filter = "型号规格 like'*" & str & "*'"

        ksrq.Value = Nothing

        jsrq.Value = Nothing

    Case "出厂编号"

        Tables("杭康设备总表").filter = "出厂编号 like'*" & str & "*'"

        ksrq.Value = Nothing

        jsrq.Value = Nothing

    Case "证书编号"

        Tables("杭康设备总表").filter = "证书编号 like'*" & str & "*'"

        ksrq.Value = Nothing

        jsrq.Value = Nothing

Case "下次检定日期"

    Tables("杭康设备总表").filter = "[运维状态] NOT =  '检定'"

        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

        tex.Value = Nothing

    Case "期间核查日期"

        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

        tex.Value = Nothing

End Select


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


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

Case "下次检定日期"
    filter = "([运维状态] is null or [运维状态] <> '检定')"
   
    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
   

[此贴子已经被作者于2018/8/14 9:01:55编辑过]

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


加好友 发短信
等级:幼狐 帖子:92 积分:824 威望:0 精华:0 注册:2017/11/23 8:55:00
  发帖心情 Post By:2018/8/14 10:31:00 [只看该作者]

谢谢帅哥,在线噢!有点甜老师,已经好了。

 回到顶部