以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  查询问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=123405)

--  作者:xybcxh
--  发布时间: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


--  作者:有点甜
--  发布时间: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
--  发布时间:2018/8/14 10:31:00
--  
谢谢帅哥,在线噢!有点甜老师,已经好了。