以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]查找问题 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=84980) |
-- 作者:wusim -- 发布时间:2016/5/14 15:27:00 -- [求助]查找问题 多内容模糊查找代码: Dim Filter As String With e.Form.Controls("单位查找") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "使用单位名称 like \'*" & .Value & "*\'" End If End With With e.Form.Controls("出厂编号查找") 如果查找多个出厂编号,也可以模糊,但不确定多少,用顿号区分, 如:1003、1004、20145 代码怎样改? If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "出厂编号 like \'*" & .Value & "*\'" End If End With If Filter > "" Then Tables("基本信息表").Filter = Filter End If |
-- 作者:Hyphen -- 发布时间:2016/5/14 16:13:00 -- With e.Form.Controls("出厂编号查找") If .Value IsNot Nothing Then Dim v() As String = .Value.split("、") Dim f2 As String For Each s As String In v f2 &= " 出厂编号 like \'%" & s & "%\' or" Next f2 = f2.SubString(0,f2.Length - 2) If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "( " & f2 & " )" End If End With
|