以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  想要做一个模糊查询  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=90779)

--  作者:lml88
--  发布时间:2016/9/21 15:34:00
--  想要做一个模糊查询
想要做一个模糊查询
[此贴子已经被作者于2016/9/21 15:37:50编辑过]

--  作者:lml88
--  发布时间:2016/9/21 15:37:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20160921153605.png
图片点击可在新窗口打开查看


想做一个模糊查询,怎么做,我的代码如下,但是这个是精准查询,我想要做模糊查询

Dim Filter As String
Dim str As String
With e.Form.Controls("TextBoxZBH")
    If .Value IsNot Nothing Then
        Filter = "自编号 = " & .Value & " "
    End If
End With
With e.Form.Controls("TextBoxCPH")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "车牌号 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("TextBoxName")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If

        Filter = "车辆名称 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("TextBoxGS")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "所属公司 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("TextBoxLX")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        str  = "\'%" & .Value & "%\'"
        Filter = Filter & "运行路线 = \'" & .Value & "\'"
    End If
End With


If Filter > "" Then
    Tables("候运客运车辆明细表").Filter = Filter
End If
[此贴子已经被作者于2016/9/21 15:43:53编辑过]

--  作者:有点蓝
--  发布时间:2016/9/21 15:56:00
--  

其它条件参考下面
With e.Form.Controls("TextBoxCPH")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "车牌号 like \'%" & .Value & "%\'"
    End If
End With

--  作者:lml88
--  发布时间:2016/9/21 16:36:00
--  
谢谢,解决了