以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]关于模糊查询的新问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=24169)

--  作者:zcw728909
--  发布时间:2012/10/6 15:45:00
--  [求助]关于模糊查询的新问题

我根据使用指南里的教程自己做了个查询窗口,效果如下:
图片点击可在新窗口打开查看此主题相关图片如下:查询.jpg
图片点击可在新窗口打开查看

但是这种查询只能查全名,比如“客户”里面必须输全称才能查到这个客户,怎样实现只需要输入其中几个字也能查询到,我的代码如下:

Dim Filter As String
With e.Form.Controls("TextBH")
    If .Value IsNot Nothing Then
        Filter = "版号 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("Textpm")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "品名 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("Textkh")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "客户名称 = \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "接稿日期>= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    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


--  作者:blackzhu
--  发布时间:2012/10/6 16:02:00
--  
 Filter = Filter & "客户名称 like \'*" & .Value & "*\'"
--  作者:zcw728909
--  发布时间:2012/10/6 16:17:00
--  
以下是引用blackzhu在2012-10-6 16:02:00的发言:
 Filter = Filter & "客户名称 like \'*" & .Value & "*\'"

谢谢了,搞定了