Sub loadtree()
Dim objnodes As Node
Dim rst As DAO.Recordset
Dim rs As DAO.Recordset
Dim i, j As Integer
Set objtree = TreeView6.Object
objtree.nodes.Clear
Set objnodes = objtree.nodes.Add(, , "No.1", "所有客户")
Set rst = CurrentDb.OpenRecordset("client查询")
Set rs = CurrentDb.OpenRecordset("client 查询")
For i = 0 To rst.RecordCount - 1
Set objnode = objtree.nodes.Add("No.1", tvwChild, "父" & rst.Fields("TypName"), rst.Fields("TypName"))
Debug.Print rst.Fields("TypName")
rs.MoveFirst
For j = 1 To rs.RecordCount
Debug.Print rs.Fields("TypName")
If rst.Fields("TypName") = rs.Fields("TypName") Then
Set objnode = objtree.nodes.Add("父" & rst.Fields("TypName"), tvwChild, "子" & rs.Fields("name"), rs.Fields("name"))
End If
rs.MoveNext
Next
rst.MoveNext
Next
rst.Close
rs.Close
End Sub
请问这段程序有何问题!为何加载数据不对呢!此程序问题是在frm主窗体里
[此贴子已经被作者于2006-8-22 22:48:27编辑过]
|