以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  用Filter筛选已选中行号列复选框的行?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=60499)

--  作者:一笑
--  发布时间:2014/11/25 22:04:00
--  用Filter筛选已选中行号列复选框的行?
Table的ShowCheckBox的逻辑属性设为True,行号列显示复选框,想用Filter筛选已选中复选框的行,该如何写代码:

Dim Filter As String

Filter = ?
Tables("订单").Filter = Filter
谢谢!

--  作者:有点甜
--  发布时间:2014/11/25 22:08:00
--  
Dim ids As String
For Each r As Row In Tables("订单表").GetCheckedRows
    ids = ids & "," & r("_Identify")
Next
Tables("订单表").Filter =  "_Identify in (" & ids.trim(",") & ")"
[此贴子已经被作者于2014-11-25 22:07:38编辑过]

--  作者:一笑
--  发布时间:2014/11/25 22:53:00
--  
谢谢。再请问如果想用Filter筛选未选中复选框的行,该如何写代码:
--  作者:有点甜
--  发布时间:2014/11/25 22:56:00
--  
 Dim ids As String
For Each r As Row In Tables("订单表").GetCheckedRows
    ids = ids & "," & r("_Identify")
Next
Tables("订单表").Filter =  "_Identify not in (" & ids.trim(",") & ")"

--  作者:一笑
--  发布时间:2014/11/25 23:30:00
--  
我想在加上一个筛选条件“地区”,老是报错,代码应该如何组合?谢谢
Dim ids As String
For Each r As Row In Tables("订单").GetCheckedRows
    ids = ids & "," & r("_Identify")
Next
Dim Filter As String
Filter = "_Identify not in (" & ids.trim(",") & ")"
With e.Form.Controls("地区")
    If .Value IsNot Nothing Then
        Filter = "地区 = \'" & .Value & " And "
    End If
End With
If Filter > "" Then
Tables("订单").Filter = Filter

--  作者:有点甜
--  发布时间:2014/11/26 9:04:00
--  

Dim ids As String
For Each r As Row In Tables("订单").GetCheckedRows
    ids = ids & "," & r("_Identify")
Next
Dim Filter As String
Filter = "_Identify not in (" & ids.trim(",") & ")"
With e.Form.Controls("地区")
    If .Value IsNot Nothing Then
        Filter = " and 地区 = \'" & .Value & "\' "
    End If
End With

Tables("订单").Filter = Filter