Private Sub Form_Load()
Dim i As Integer
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("SELECT * FROM menu;") ‘以要链接的表建立记录集
If rst.RecordCount = 0 Then MsgBox "表中无数据!程序终止。": Exit Sub ‘如果链接表无数据
i = 1
rst.MoveFirst ‘记录首
While Not rst.EOF ‘循环记录
With Me.TreeView0.Nodes ‘每循环1条记录添加一个分类
.Add , 4, "s" & i, "" & rst(1) & ""
End With
i = i + 1
rst.MoveNext ‘下一条记录
Wend
End Sub
Private Sub TreeView0_DblClick()
Me.win.SourceObject = "login"
End Sub
原文:https://www.cnblogs.com/ince/p/8988420.html