
StrText = rst! & ( ", " + rst! ) 'Add as a child node to the tree. Rst.FindFirst " =" & Mid (nodBoss.Key, 2 ) 'Build the list of employees who report to this supervisor. 'Find the first employee who reports to the supervisor for this node. '= Sub AddChildren (nodBoss As Node, rst As Recordset ) On Error GoTo ErrAddChildrenĭim strText As String, bk As String 'Create a reference to the TreeView control. ' 'Note that this procedure accepts the open Employees recordset by 'reference so you do not have to open a new recordset for each call. MsgBox Err.Description, vbCritical, "Form_Load" Resume ExitForm_LoadĮnd Sub '= 'This procedure adds child nodes to the tree for all employees who 'report to a particular supervisor, and calls itself recursively 'to add child nodes for all other employees they supervise.

'Run a recursive procedure to add all the child nodes 'for employees who report to this supervisor. StrText ) 'Use a placeholder to save this place in the recordset. Set nodCurrent = (,, "a" & rst!EmployeeID, _ StrText = rst! & ( ", " + rst! ) 'Add a root level node to the tree for the supervisor. Rst.FindFirst " Is Null" 'Build the TreeView list of supervisors and their employees.

'Find the first employee who is a supervisor. Set rst = db.OpenRecordset ( "Employees", dbOpenDynaset, dbReadOnly ) 'Create a reference to the TreeView Control.

'= Private Sub Form_Load ( ) On Error GoTo ErrForm_Loadĭim strText As String, bk As String Set db = CurrentDb '= 'This procedure populates the TreeView control when the form opens.
