I'm getting nodes into the thing, but when the dust settles, only the root-level
nodes are visible.
I know they're there because .Nodes.Count gives the right number.\
But I don't really understand the significance of the Nodes.Add syntax - I'm
just slavishly plugging in values.
Viz:
---------------------------
Public Sub ClassMembersLoad(ByVal theClassID As Long, ByVal theMaxLevels As
Long)
1000 debugStackPush Me.Name & ": ClassMembersLoad"
1001 On Error GoTo ClassMembersLoad_err
' PURPOSE: Allow the "Classes" subform to load the "ClassMember"
' tree with members of currently selected class
' ACCEPTS: - ClassID of class's members TB loaded.
' - Max levels TB expected for the class in question
1002 Dim thisDB As DAO.Database
Dim myRS As DAO.Recordset
Dim myQuery As DAO.QueryDef
Dim curNode As Node
Dim curChild As String
Dim curParent As String
Dim i As Integer
1009 Me.treClassMembers.Nodes.Clear
1010 Set thisDB = CurDB()
1020 For i = 1 To theMaxLevels
1030 Set myQuery = thisDB.QueryDefs("qryAdminClassMembersLoad")
1031 With myQuery
1032 .Parameters("theClassID") = theClassID
1033 .Parameters("theLevel") = i
On Error Resume Next
myRS.Close
On Error GoTo ClassMembersLoad_err
1035 Set myRS = .OpenRecordset(dbOpenSnapshot, dbForwardOnly)
1039 End With
1040 With myRS
1041 If Not ((.BOF = True) And (.EOF = True)) Then
1042 Do Until .EOF = True
1043 If Val(!ParentClassMemberID & "") = 0 Then
1044 curChild = !ChildName & "-" & !ChildDescription
1045 Set curNode = Me.treClassMembers.Nodes.Add(, , curChild,
curChild)
'1045 Set curNode = Me.treClassMembers.Nodes.Add(, ,
CStr(!ChildClassMemberID), curChild)
1046 Else
1049 curChild = !ChildName & "-" & !ChildDescription
1050 curParent = !ParentName & "-" & !ParentDescription
1051 Set curNode = Me.treClassMembers.Nodes.Add(curParent,
tvwChild, curChild, curChild)
'1051 Set curNode = Me.treClassMembers.Nodes.Add(curParent,
tvwChild, !ChildClassMemberID, curChild)
' Set curNode = trTable.Nodes.Add(CStr(recLevel2("level1")),
tvwChild, CStr(recLevel2("NodeName")) & "(" & CStr(recLevel2("NodeName")) & ")",
recLevel2("level2"))
1052 End If
1053 .MoveNext
1054 Loop
1055 End If
1059 End With
1999 Next i
'With Me.treClassMembers.Nodes
' For i = 1 To .Count
' Debug.Print .Item(i)
' Next i
'End With
ClassMembersLoad_xit:
debugStackPop
On Error Resume Next
Set myQuery = Nothing
myRS.Close
Set myRS = Nothing
Set thisDB = Nothing
Exit Sub
ClassMembersLoad_err:
bugAlert True, ""
Resume ClassMembersLoad_xit
End Sub
---------------------------
Some time ago Larry Linton pointed me to
http://www.mvps.org/ccrp/controls/ccrpftv6.htm
which works great.
Only problem is that with my current project there is zero chance of registering
an new OCX on a user's machine (corporate security policy).
So I'm back to the plain-vanilla-out-of-the-box control.
Anybody know where to find a decent writeup on the ins and outs of using it.
--
PeteCresswell