以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  筛选出错  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=120953)

--  作者:susu312
--  发布时间:2018/6/26 22:47:00
--  筛选出错


图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看
源码:

Dim Filter As String
\'\'统计离退休
With e.Form.Controls("cmbRetire")
    If .Value IsNot Nothing Then
        Filter = " leaOrRetire= \'" & .Value & "\'"
    End If
End With
\'\'统计党龄
With e.Form.Controls("cmbPartySta")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & " partyStanding= \'" & .Value & "\'"
    End If
End With
\'\'统计职务
With e.Form.Controls("cmbPos")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "retiredPost= \'" & .Value & "\'"
    End If
End With
\'
With e.Form.Controls("cmbPoSta")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "politicalStatus= \'" & .Value & "\'"
    End If
End With

With e.Form.Controls("StartDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("EndDate")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "日期 <= #" & .Value & "#"
    End If
End With
 \'
If Filter > "" Then
    Tables("person").Filter = Filter
End If

 

 

 

老师,我有2个问题请教您

1、在筛选职务和政治面貌时,选定多个选项,选出来的就是空的?实际不应该是空的

2、需求里面有统计党龄50年以上人员,我有党员这一列 ,通过数值框可以选出50,但是可不可以给出大于,小于,等于三个选项,进行选择

 


--  作者:有点蓝
--  发布时间:2018/6/26 23:02:00
--  
1

\'\'统计职务
With e.Form.Controls("cmbPos")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "retiredPost in (\'" & .Value.replace(",","\',\'") & "\')"
    End If
End With

2、增加一个组合框选择咯
\'\'统计党龄
With e.Form.Controls("cmbPartySta")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & " partyStanding " & e.Form.Controls("大于,小于,等于三个选项组合框").text & " \'" & .Value & "\'"
    End If
End With