以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]怎样实现这种筛选功能? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=91534) |
-- 作者:wusim -- 发布时间:2016/10/12 20:40:00 -- [求助]怎样实现这种筛选功能? 怎样实现这种筛选功能? 设置了一个使用单位的筛选框,我想在这个框输入单位名1、单位名2、单位3 可能是3个以上,不确定。代码怎样写? |
-- 作者:有点蓝 -- 发布时间:2016/10/12 20:53:00 -- \'\'\' Dim dw As String = e.Form.controls("ComboBox1").Text Tables("表A").Filter = "单位 in (\'" & dw.Replace("、","\',\'") & "\')"
|
-- 作者:wusim -- 发布时间:2016/10/12 21:49:00 -- 单位名能不能改成可以模糊查找 |
-- 作者:有点蓝 -- 发布时间:2016/10/12 22:10:00 -- \'\'\' Dim dw As String = e.Form.controls("ComboBox1").Text Dim str() As String = dw.Split("、") Dim filter As String = "1=2" For Each s As String In str filter &= " or 单位 like \'%" & s & "%\'" Next Tables("表A").Filter = filter
|
-- 作者:wusim -- 发布时间:2016/10/12 22:19: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("合同号查找") 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("出厂编号查找") 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("制造日期查找") If .Value IsNot Nothing Then If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "制造日期 >= #" & .Value & "#" End If End With With e.Form.Controls("制造日期查找2") 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 [此贴子已经被作者于2016/10/12 22:20:23编辑过]
|
-- 作者:有点蓝 -- 发布时间:2016/10/12 22:43:00 -- With e.Form.Controls("单位查找") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Dim str() As String = .Value.Split("、") filter &= "(1=2" For Each s As String In str filter &= " or 使用单位 like \'%" & s & "%\'" Next filter &= ")" End If End With
[此贴子已经被作者于2016/10/12 22:44:07编辑过]
|
-- 作者:wusim -- 发布时间:2016/10/12 23:20:00 -- 可以了,谢谢老师。 [此贴子已经被作者于2016/10/13 6:19:34编辑过]
|