以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]筛选时怎么排除隐藏行 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=126077) |
-- 作者:tkxffb -- 发布时间:2018/10/13 15:39:00 -- [求助]筛选时怎么排除隐藏行 各位老师,在主窗口中有一个筛选面板,主窗口的表名是《人员信息表》,《人员信息表》中有隐藏的行,即在职人员显示、离职人员隐藏,现在我想对可见行按条件进行筛选。我参照帮助文件写的筛选代码是: Dim Filter As String With e.Form.Controls("县市区") If .Value IsNot Nothing Then Filter = "县市区 = \'" & .Value & "\'" End If End With With e.Form.Controls("乡镇办") If .Value IsNot Nothing Then Filter = "乡镇办 = \'" & .Value & "\'" End If End With With e.Form.Controls("现任职务") If .Value IsNot Nothing Then Filter = "现任职务 = \'" & .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("政治面貌") 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 问题是在点击筛选按钮进行筛选后,隐藏的行也会显示出来。但我只希望筛选可见行,请问怎么写筛选代码?谢谢! 补充说明一下,我用的隐藏代码是:Tables("人员信息表").Filter = "任职状态 <> \'离职\'" \'-----隐藏离职的行
[此贴子已经被作者于2018/10/13 15:40:09编辑过]
|
-- 作者:y2287958 -- 发布时间:2018/10/13 15:42:00 -- 加上原来的条件就可以了 |
-- 作者:tkxffb -- 发布时间:2018/10/13 15:45:00 -- 谢谢y2287958马上给出解答,可是代码我不会写,能麻烦您写一下吗? |
-- 作者:tkxffb -- 发布时间:2018/10/13 15:47:00 -- 下面的写法是把隐藏代码加到筛选代码后面,我已经试过了,筛选动作就无法执行了,点击筛选按钮没的反应 Dim Filter As String With e.Form.Controls("县市区") If .Value IsNot Nothing Then Filter = "县市区 = \'" & .Value & "\'" End If End With With e.Form.Controls("乡镇办") If .Value IsNot Nothing Then Filter = "乡镇办 = \'" & .Value & "\'" End If End With With e.Form.Controls("现任职务") If .Value IsNot Nothing Then Filter = "现任职务 = \'" & .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("政治面貌") 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 Tables("人员信息表").Filter = "任职状态 <> \'离职\'" \'-----隐藏离职的行 |
-- 作者:有点蓝 -- 发布时间:2018/10/13 15:52:00 -- If Filter > "" Then Tables("人员信息表").Filter = Filter & " and 任职状态 <> \'离职\'" End If
|
-- 作者:tkxffb -- 发布时间:2018/10/13 15:58:00 -- 有点蓝老师太牛了,轻而易举帮我解决了问题,谢谢 |