以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=135250)

--  作者:回忆美好wy
--  发布时间:2019/5/21 20:02:00
--  [求助]
我实现了多条件组合查询,代码如下,怎样在此基础实现  缺陷所在相序、所属10千伏线路 、所属支线 的模糊查找呢?
Dim Filter As String
With e.Form.Controls("ComboBox按所属供电所查询")
    If .Value IsNot Nothing Then
        Filter = "所属供电所 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("ComboBox按相序查找")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "缺陷所在相序 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("TextBox所属10千伏线路")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "所属10千伏线路 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("TextBox所在支线")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "所属支线 = \'" & .Value & "\'"
    End If
End With

If Filter > "" Then
    Tables("缺陷隐患库原始数据表").Filter = Filter
End If

--  作者:有点蓝
--  发布时间:2019/5/21 20:19:00
--  
http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=50080

如:

Filter = Filter & "缺陷所在相序 like \'%" & .Value & "%\'"