此主题相关图片如下:gif 2020-01-27 17-55-59.gif
![dvubb 图片点击可在新窗口打开查看](UploadFile/2020-1/20201271851530156.gif)
如果点击速度快,会出现选中的和表不一致
代码:
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim flt As String
For Each nd As WinForm.TreeNode In e.node.AllNodes '同步子节点选中状态
If nd.FullPath.StartsWith(e.node.FullPath) Then
nd.Checked = e.node.Checked
End If
Next
For Each nd As WinForm.TreeNode In trv.AllNodes
If nd.Checked Then
If flt > "" Then
flt = flt & " Or " '注意用or而不是And
End If
If nd.Level = 0 Then '注意下面的条件都要用括号括起来
flt = flt & "( 单位名称 = '" & nd.Text & "')"
Else
flt = flt & "( 单位名称 = '" & nd.Text & "')"
'flt = flt & "( 产品 = '" & nd.ParentNode.Text & "' And 客户 = '" & nd.Text & "')"
End If
End If
Next
Tables("人员信息").Filter = flt
[此贴子已经被作者于2020/1/27 20:20:18编辑过]