以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]筛选能不能简化 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=189943) |
-- 作者:hbkongxin -- 发布时间:2024/1/6 9:16:00 -- [求助]筛选能不能简化 这个我是放在窗口事件中的文本改变后执行,相当于每输入一个字就会筛选,经常碰到按一个字要卡个半秒一秒 Select Case e.Sender.Name Case "业务员", "客户", "花号", "色位", "面料", "打印机台", "调色员", "调色完成", "调完起始", "调完结束" Dim Filter As String With e.Form.Controls("业务员") If .text > "" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "业务员 like \'%" & .text & "%\'" End If End With With e.Form.Controls("客户") If .text > "" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "客户 like \'%" & .text & "%\'" End If End With With e.Form.Controls("花号") If .text > "" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "花号 like \'%" & .text & "%\'" End If End With With e.Form.Controls("色位") If .text > "" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "色位 like \'%" & .text & "%\'" End If End With With e.Form.Controls("面料") If .text > "" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "面料 like \'%" & .text.replace("*", "[*]") & "%\'" End If End With With e.Form.Controls("打印机台") If .text > "" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "打印机台 like \'%" & .text & "%\'" End If End With With e.Form.Controls("调色员") If .text > "" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "调色员 like \'%" & .text & "%\'" End If End With With e.Form.Controls("调完起始") If .text > "" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "调完日期 >= #" & .text & "#" End If End With With e.Form.Controls("调完结束") If .text > "" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "调完日期 <= #" & .text & "#" End If End With If e.Form.Controls("调色完成").Text = "·" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "调色完成 = false" End If If e.Form.Controls("调色完成").Text = "调完" Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "调色完成 = true" End If If Filter > "" Then Tables("计划").Filter = Filter End If End Select
|
-- 作者:有点蓝 -- 发布时间:2024/1/6 9:35:00 -- 如果是放到textchenged事件,就是输入一个字符就筛选一次,如果数据多,并且会触发一些表事件,是需要时间的 如果想输入完毕才筛选,就放到valuechanged事件
|
-- 作者:hbkongxin -- 发布时间:2024/1/6 9:56:00 -- 那我上面那些能简化吗?这么长一串看着好麻烦 |
-- 作者:有点蓝 -- 发布时间:2024/1/6 10:03:00 -- 可以简化一些,但是差不了多少。新版编辑器可以折叠代码,不想看折叠呗 |