Foxtable(狐表)用户栏目专家坐堂 → [求助]关于模糊查询的新问题


  共有8986人关注过本帖树形打印复制链接

主题:[求助]关于模糊查询的新问题

帅哥哟,离线,有人找我吗?
zcw728909
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:209 积分:1607 威望:0 精华:0 注册:2012/9/7 20:24:00
[求助]关于模糊查询的新问题  发帖心情 Post By: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
  2楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 一级勋章
等级:狐仙 帖子:9875 积分:57584 威望:0 精华:15 注册:2008/9/1 9:45:00
  发帖心情 Post By:2012/10/6 16:02:00 [只看该作者]

 Filter = Filter & "客户名称 like '*" & .Value & "*'"

 回到顶部
帅哥哟,离线,有人找我吗?
zcw728909
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:209 积分:1607 威望:0 精华:0 注册:2012/9/7 20:24:00
  发帖心情 Post By:2012/10/6 16:17:00 [只看该作者]

以下是引用blackzhu在2012-10-6 16:02:00的发言:
 Filter = Filter & "客户名称 like '*" & .Value & "*'"

谢谢了,搞定了


 回到顶部