不会做,上传具体实例
Dim trv As WinForm.TreeView = e.Sender
Dim flt As String
If e.Node.Text = "显示所有客户" Then
flt = ""
Else
For Each nd As WinForm.TreeNode In e.node.Nodes '清除子节点选中状态
nd.Checked = False
Next
If e.node.ParentNode IsNot Nothing Then '去掉父节点选中状态
e.node.ParentNode.Checked = False
End If
For Each nd As WinForm.TreeNode In trv.AllNodes
If nd.Checked Then
If flt > "" Then
flt = flt & " Or " '注意用or而不是And
End If
Select Case nd.Level
Case 0
flt = flt & "( 客户类别 = '" & nd.Text & "')" '注意条件都要用括号括起来
Case 1
flt = flt & "( 客户类别 = '" & nd.ParentNode.Text & "' And 客户类别 = '" & nd.Text & "')"
End Select
End If
Next
end if
Tables("客户信息表").Filter = flt