-- 作者: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
|