1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| Public Function LoadTreeview()
Dim tv As MSComctlLib.TreeView
Dim nodX As MSComctlLib.Node
Dim nodChantiers As MSComctlLib.Node
Dim nodDossiersFinancementTitre As MSComctlLib.Node
Dim nodChantiersTitre As MSComctlLib.Node
Dim rstClient As DAO.Recordset
Dim rstChantiers As DAO.Recordset
Dim sTrouv As String
Set tv = Forms![TreeView].ctrlTreeView.Object
Set rstClient = CurrentDb.OpenRecordset("select top 1 * from clients order by clients.nom")
Set rstChantiers = CurrentDb.OpenRecordset("select * from [nature chantier]")
Do While Not rstClient.EOF
Set nodX = tv.Nodes.Add(, , "<NumClient>" & rstClient!NumClient & "</NumClient>", "(" & rstClient!NumClient & ")" & " " & rstClient!Nom & " " & rstClient!Prénom)
Set nodChantiersTitre = tv.Nodes.Add(nodX, , , "Chantiers :")
sTrouv = "Client='" & rstClient!NumClient & "'"
rstChantiers.FindFirst sTrouv
Do While Not rstChantiers.NoMatch
Set nodChantiers = tv.Nodes.Add(nodChantiersTitre, tvwChild, "<NumClient>" & rstChantiers!NumDossier & "</Numclient>", rstChantiers!NumDossier)
rstChantiers.FindNext sTrouv
Loop
rstClient.MoveNext
Loop
Set nodDossiersFinancementTitre = tv.Nodes.Add(nodX, , , "Dossiers de financement")
End Function |
Partager