以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [原创]  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=123406)

--  作者:xybcxh
--  发布时间:2018/8/14 9:08: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 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 10:24:00
--  

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=123405&skin=0

 


--  作者:xybcxh
--  发布时间:2018/8/14 10:34:00
--  
因为找不到前面发的贴子,所以又发了,麻烦老师了。谢谢帅哥,在线噢!有点甜老师,已经好了。