Private Sub TreeView2_NodeCheck(ByVal Node As Object)
Dim Str As String
Dim I As Integer
Dim tNode As Node
Dim tR As TreeView
Set tR = Me.TreeView2.Object
For Each tNode In tR.Nodes
If tNode.Key <> "Toop" Then
If tNode.Checked = True Then
Str = Str & "," & tNode.Text
End If
End If
Next
Str = Right(Str, Len(Str) - 1)
Me.Child0.Form.Filter = "[BreedName] like '*" & Str & "*'"
Me.Child0.Form.FilterOn = True
End Sub
sub myFilter(s as string)
'参数:s 取值为 and/or
Dim Str As String
Dim I As Integer
Dim tNode As Node
Dim tR As TreeView
Set tR = Me.TreeView2.Object
select case s
case "or"
str="false"
case "and"
str="true"
case else
exit sub
end select
For Each tNode In tR.Nodes
If tNode.Key <> "Toop" Then
If tNode.Checked = True Then
Str = Str & " " & s & " [BreedName] like '*" & tNode.Text & "*'"
End If
End If
Next
Me.Child0.Form.Filter = Str
Me.Child0.Form.FilterOn = True
end sub