Public Sub Tree_change()
TreeView1.Nodes.Clear
Dim Nod As Node '创建树
Dim key, text As String
text = "小型企业管理系统"
Set Nod = TreeView1.Nodes.Add(, tvwChild, , text, 1)
Dim nodex As Node
Dim str As ADODB.Recordset
Dim str1 As ADODB.Recordset
Dim strSQL As String
Dim a As String, b As String
a = "main_menu"
TreeView1.LineStyle = tvwRootLines
strSQL = "select distinct main_menu from department order by main_menu"
Set str = ExecuteSQL(strSQL)
strSQL = "select distinct main_menu,son_menu from department order by main_menu,son_menu"
Set str1 = ExecuteSQL(strSQL)
str.MoveFirst
Do Until str.EOF
str1.MoveFirst
Set nodex = TreeView1.Nodes.Add(1, tvwChild, a, str.Fields(0), 1, 1)
Do Until str1.EOF
If str.Fields(0) = str1.Fields(0) Then
' Set nodex = TreeView1.Nodes.Add(2, tvwChild, a, str1.Fields(1), 2, 2)
End If
str1.MoveNext
Loop
a = a & "1"
str.MoveNext
Loop
str.Close
str1.Close
Set str = Nothing
Set str1 = Nothing
nodex.EnsureVisible '展开结点
End Sub
程序运行中出现错误,出现错误的行就是被注销的那一句,大家请帮帮忙,究竟该怎么改
提示错误是: 实时错误“35602” 集合中的关键字不唯一