TreeView.Nodes.Add 套过来不能用?运行时错误‘35601’
我用红尘如烟一个树型套了一个,用不到,不知道什么原因?
我直接把T2表
编码权限名称
01水果
0101苹果
010101红富士
010102青苹果
0102雪梨
02蔬菜
0201萝卜
020101红萝卜
020102白萝卜
0203冬瓜
0204小白菜
03零食
0301小蛋糕
0302饼干
04饮料
改成了T4表
权限权限名称
001水果
00101苹果
0010101红富士
0010102青苹果
00102雪梨
002蔬菜
00201萝卜
0020101红萝卜
0020102白萝卜
00203冬瓜
00204小白菜
003零食
00301小蛋糕
00302饼干
004饮料
代码同以前:
Dim Rst As New ADODB.Recordset, Node As Object
Rst.Open "SELECT * FROM T2 ORDER BY C1", CurrentProject.Connection
With Me.TV0
'.Font.Size = 10
.FullRowSelect = True '节点整行选中
Do Until Rst.EOF
If Len(Rst!C1) = 2 Then
.Nodes.Add , , "T" & Rst!C1, Rst!C2
Else
.Nodes.Add "T" & Left(Rst!C1, Len(Rst!C1) - 2), tvwChild, "T" & Rst!C1, Rst!C2
End If
Rst.MoveNext
Loop
End With
Rst.Close
Set Rst = Nothing
改成了
Dim Rst As New ADODB.Recordset, Node As Object
Rst.Open "SELECT * FROM T2 ORDER BY C1", CurrentProject.Connection
With Me.TV0
'.Font.Size = 10
.FullRowSelect = True '节点整行选中
Do Until Rst.EOF
If Len(Rst!C1) = 3 Then
.Nodes.Add , , "T" & Rst!C1, Rst!C2
Else
.Nodes.Add "T" & Left(Rst!C1, Len(Rst!C1) - 2), tvwChild, "T" & Rst!C1, Rst!C2
End If
Rst.MoveNext
Loop
End With
Rst.Close
Set Rst = Nothing
运行就报错不能用
运行时错误‘35601’
Element not found
[解决办法]
解决了记着结贴啊。