以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  后台筛选代码问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=111210)

--  作者:aza520
--  发布时间:2017/12/17 20:34:00
--  后台筛选代码问题
开始筛选按钮设置如下代码,但是实现不了后台筛选,请老师指点

Dim Filter As String
With e.Form.Controls("DateTimePicker1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "支付日期 >= #" & .Value & "#"
    End If
End With
With e.Form.Controls("DateTimePicker2")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "支付日期 <= #" & .Value & "#"
    End If
End With

If e.Form.Controls("RadioButton5").Checked = True \' 如果付款状态选择了"已付"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "乡镇审核 = True"
End If
If e.Form.Controls("RadioButton6").Checked = True \' 如果付款状态选择了"未付"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "乡镇审核 = False Or 乡镇审核 Is Null"
End If

If e.Form.Controls("RadioButton2").Checked = True \' 如果付款状态选择了"已付"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "是否结算 = True"
End If
If e.Form.Controls("RadioButton3").Checked = True \' 如果付款状态选择了"未付"
    If Filter >"" Then
        Filter = Filter & " And "
    End If
    Filter = Filter & "是否结算 = False Or 是否结算 Is Null"
End If
If Filter > "" Then
    Tables("S征地记录").Filter = Filter
End If

--  作者:有点甜
--  发布时间:2017/12/17 21:02:00
--  

Tables("S征地记录").Filter = Filter

 

改成

 

Tables("S征地记录").DataTable.LoadFilter = Filter

Tables("S征地记录").DataTable.Load


--  作者:aza520
--  发布时间:2017/12/17 21:58:00
--  
OK了,谢谢老师