版主大人,请帮忙一下,请注释一下,好吗?
Dim syDB As Database, syRecSet As DAO.Recordset, sySubRecSet As DAO.Recordset
Dim strID As String, imgID As Integer
Set syDB = CurrentDb()
Set syRecSet = syDB.OpenRecordset("SELECT 顺序, 基础资料名称,strRecSet FROM 基础资料名称 ORDER BY 顺序;")
With syRecSet
.MoveLast
.MoveFirst
End With
Do While Not syRecSet.EOF
strID = "No" & syRecSet("顺序")
imgID = CInt(syRecSet("顺序"))
Set mNode = AtxTreeView.Nodes.Add(, , strID, syRecSet("基础资料名称"), 7, 8)
mNode.Tag = "main"
Set sySubRecSet = syDB.OpenRecordset(syRecSet("strRecSet"))
With sySubRecSet
.MoveLast
.MoveFirst
End With
Do While Not sySubRecSet.EOF
Set mNode = AtxTreeView.Nodes.Add(strID, tvwChild, strID & sySubRecSet("NO"), sySubRecSet("Name"), imgID, 6)
mNode.Tag = "sub"
sySubRecSet.MoveNext
Loop
syRecSet.MoveNext
Loop
With AtxTreeView
.Refresh
.Nodes(1).Sorted = True
.Nodes(1).Expanded = True
End With