使用一个全局变量,比如集合,每一次筛选就把条件放入集合。上一次就是集合里倒数第二项的条件
自定义函数
creatfilters 筛选之后记录当前筛选的表和筛选规则
If Vars("tbname") <> "" Then
If Vars("tbname") = CurrentTable.Name Then
Vars("tbname") = CurrentTable.Name
tbfilters.Add(CurrentTable.Filter)
Else
Vars("tbname") = CurrentTable.Name
tbfilters.Clear
tbfilters.Add(CurrentTable.Filter)
End If
Else
Vars("tbname") = CurrentTable.Name
tbfilters.Clear
tbfilters.Add(CurrentTable.Filter)
End If
withdrawfilter 撤回筛选
If Vars("tbname") <> "" Then
If Vars("tbname") = CurrentTable.Name Then
Try
Dim c As Integer = tbfilters.Count - 1
If c = 0 Then
CurrentTable.Filter = ""
tbfilters.Clear
Else
CurrentTable.Filter = tbfilters(c - 1)
tbfilters.RemoveAt(c)
End If
Catch ex As Exception
End Try
Else
Vars("tbname") = Nothing
tbfilters.Clear
End If
End If