Dim trv As WinForm.TreeView = e.Sender Dim flt As String For Each nd As WinForm.TreeNode In e.node.Nodes '同步子节点选中状态 nd.Checked = e.Node.Checked 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.Level > 0 AndAlso nd.ParentNode.Checked Then '如果父节点选中 Continue For '跳过此节点,处理下一结点 End If If nd.Checked Then If flt > "" Then flt = flt & " Or " '注意用or而不是And End If Select Case e.Node.Level Case 0 flt = flt & "( 统计年度 = '" & nd.Text & "')" Case 1 flt = flt & "( 统计年度 = '" & nd.ParentNode.Text & "' And 统计月份 = '" & nd.Text & "')" Case 2 flt = flt & "( 统计年度 = '" & nd.ParentNode.ParentNode.Text & "' And 统计月份 = '" & nd.ParentNode.Text & "' and 通知日期 = # " & nd.Text & " #)" End Select End If Next If flt = "" Then flt = "[_Identify] Is Null" End If DataTables("销售订单").LoadFilter = flt DataTables("销售订单").Load() DataTables("明细").Load()
|