以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]筛选时如果筛选了性别其他筛选项不起作用  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=148747)

--  作者:tkxffb
--  发布时间:2020/4/14 17:15:00
--  [求助]筛选时如果筛选了性别其他筛选项不起作用
各位老师好,下面是筛选代码,如果不筛选性别,筛选正常,如果各项同时筛选,则只有性别项起作用,请看看问题出在哪里,谢谢

Dim Filter As String   

With e.Form.Controls("县市区")

    If .Value IsNot Nothing Then

        If Filter >"" Then

            Filter = Filter & " And "

        End If

        Filter = "县市区 = \'" & .Value & "\'"

    End If

End With

With e.Form.Controls("乡镇办")

    If .Value IsNot Nothing Then

        If Filter >"" Then

            Filter = Filter & " And "

        End If

        Filter = "乡镇办 = \'" & .Value & "\'"

    End If

End With

With e.Form.Controls("性别")

    If .Value IsNot Nothing Then

        If Filter >"" Then

            Filter = Filter & " And "

        End If

        Filter = "性别 = \'" & .Value & "\'"

    End If

End With

If Filter > "" Then

    Tables("在职人员信息表").Filter = Filter 

End If


--  作者:有点蓝
--  发布时间:2020/4/14 17:37:00
--  
Filter = Filter & "乡镇办 = \'" & .Value & "\'"

Filter = 
Filter & "性别 = \'" & .Value & "\'"
--  作者:tkxffb
--  发布时间:2020/4/14 17:54:00
--  
改好了。
我的疏忽造成的,麻烦了,谢谢蓝板