以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  后台筛选代码如何改?如何显示出来?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=177409)

--  作者:myredsun
--  发布时间:2022/5/20 17:09: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

        If Filter > "" Then

            Filter = Filter & " And "

        End If

        Filter = Filter & "经济体单元 = \'" & .Value & "\'"

    End If

End With



如何改成从后台筛选?请教有劳各位前辈了。


--  作者:有点蓝
--  发布时间:2022/5/20 17:11:00
--  
参考:http://www.foxtable.com/webhelp/topics/1928.htm

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

        If Filter > "" Then

            Filter = Filter & " And "

        End If

        Filter = Filter & "经济体单元 = \'" & .Value & "\'"

    End If

End With

DataTables("订单").LoadFilter = Filter 
DataTables(
"订单").Load


--  作者:myredsun
--  发布时间:2022/5/20 17:15:00
--  
谢谢老师
--  作者:myredsun
--  发布时间:2022/5/20 22:58: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
        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
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



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

With e.Form.Controls("NumericComboBox1")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "合约到期月数 >= \'" & .Value & "\'"
    End If
End With
With e.Form.Controls("NumericComboBox2")
    If .Value IsNot Nothing Then
        If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "合约到期月数 <= \'" & .Value & "\'"
    End If
End With

If e.Form.Controls("已确定").Checked = 1 \' 如果付款状态选择了"已付"
          If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "确定 = 1"
End If
If e.Form.Controls("未确定").Checked = 1 \' 如果付款状态选择了"未付"
          If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "确定 = 0 OR 确定 Is Null"
End If
\'If Filter > "" Then
\'    Tables("合同管理").Filter = Filter
\'End If
DataTables("合同管理").LoadFilter = Filter 
DataTables("合同管理").Load

--  作者:myredsun
--  发布时间:2022/5/20 22:59:00
--  
黄色部分实现不了。老师!请教那里出问题了?
--  作者:有点蓝
--  发布时间:2022/5/21 9:10:00
--  
If e.Form.Controls("已确定").Checked = true \' 如果付款状态选择了"已付"
          If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "确定 = 1"
End If
If e.Form.Controls("未确定").Checked = true  \' 如果付款状态选择了"未付"
          If Filter >"" Then
            Filter = Filter & " And "
        End If 
        Filter = Filter & "(确定 = 0 OR 确定 Is Null)"
End If


--  作者:myredsun
--  发布时间:2022/5/23 9:16:00
--  
太好了,太有用了。想了多天都没有解决。非常谢谢老师