Foxtable(狐表)用户栏目专家坐堂 → [求助]请问老师筛选的问题代码


  共有1756人关注过本帖树形打印复制链接

主题:[求助]请问老师筛选的问题代码

帅哥哟,离线,有人找我吗?
有点色
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/4/21 14:15:00 [显示全部帖子]

改一下代码

 

Dim Filter As String
With e.Form.Controls("序号1")
    If .Value IsNot Nothing Then
        Filter = "序号 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("年度1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "年度 in ('" & .Value.replace(",", "','") & "')"
    End If
End With
With e.Form.Controls("季度1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "季度 in ('" & .Value.replace(",", "','") & "')"
    End If
End With
With e.Form.Controls("道路名称1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "道路名称 in ('" & .Value.replace(",", "','") & "')"
    End If
End With
With e.Form.Controls("隐患地名1")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "隐患地名 = '" & .Value & "'"
    End If
End With
If e.Form.Controls("yizhenggai").Checked = True ' 如果付款状态选择了"已整改"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "是否整改 = True"
End If
If e.Form.Controls("quanbu").Checked = True ' 如果付款状态选择了"全部" Then
Tables("道路隐患表").ApplyFilter = False
End If
If e.Form.Controls("weizhenggai").Checked = True ' 如果付款状态选择了"未整改"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "是否整改 = False Or 是否整改 Is Null"
End If
If Filter > "" Then
    Tables("道路隐患表").Filter = Filter
End If


 回到顶部