That is a pretty big question, but everything you need is right here?
How to fill a Treeview control recursively in Access 2000
This code should be about 99% right for you.
Private Sub Form_Load()
Const strTableName = "CatTable"
Dim db As DAO.Database
dim rst As DAO.Recordset
Set db = CurrentDb
Set rst = db.OpenRecordset(strTableName, dbOpenDynaset, dbReadOnly)
AddBranch rst:=rst, strPointerField:="ParentID", strIDField:="CatID", strTextField:="CatName",0
End Sub
'================= AddBranch Sub Procedure ======================
' Recursive Procedure to add branches to TreeView Control
'Requires:
' ActiveX Control: TreeView Control
' Name: xTree
'Parameters:
' rst: Self-referencing Recordset containing the data
' strPointerField: Name of field pointing to parent's primary key
' strIDField: Name of parent's primary key field
' strTextField: Name of field containing text to be displayed
'=============================================================
Sub AddBranch(rst As Recordset, strPointerField As String, _
strIDField As String, strTextField As String, _
Optional varReportToID As Variant)
On Error GoTo errAddBranch
Dim nodCurrent As Node, objTree As TreeView
Dim strCriteria As String
dim strText As String
dim strKey As String
Dim nodParent As Node
dim bk As String
Set objTree = Me!xTree.Object
If varReportToID = 0 Then ' Root Branch.
strCriteria = strPointerField = 0
Else ' Search for records pointing to parent.
strCriteria = BuildCriteria(strPointerField, _
rst.Fields(strPointerField).Type, "=" & varReportToID)
Set nodParent = objTree.Nodes("a" & varReportToID)
End If
' Find the first record under the top level.
rst.FindFirst strCriteria
Do Until rst.NoMatch
' Create a string with CATName.
strText = rst(strTextField)
strKey = "a" & rst(strIDField)
If Not varReportToID = 0 Then 'add new node to the parent
Set nodCurrent = objTree.Nodes.Add(nodParent, tvwChild, strKey, strText)
Else ' Add new node to the root.
Set nodCurrent = objTree.Nodes.Add(, , strKey, strText)
End If
' Save your place in the recordset so we can pass by ref for speed.
bk = rst.Bookmark
' Add node that are under this node.
AddBranch rst, strPointerField, strIDField, strTextField, rst(strIDField)
rst.Bookmark = bk ' Return to last place and continue search.
rst.FindNext strCriteria ' Find next subnode
Loop
exitAddBranch:
Exit Sub
'--------------------------Error Trapping ------
errAddBranch:
MsgBox "Can't add child: " & Err.Description, vbCritical, "AddBranch Error:"
Resume exitAddBranch
End Sub