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 39 40 41
| Option Compare Database
Private myDAODB As DAO.Database
Private Sub mysubLANCEMENT()
myCHEMIN = ""
Set myDAODB = CurrentDb
Call mysubREC("DEBUT", "DEBUT")
Set myDAODB = Nothing
End Sub
Private Sub mysubREC(myTACHE As String, myCHEMIN As String)
Dim myQuery As String
Dim myNextTache As String
Dim myDAOREC As DAO.Recordset
Dim mycheminsauv As String
If Not myTACHE = "FIN" Then 'si on n'est pas a la dernière tâche
myQuery = "SELECT tbDEPENDANCES.* FROM tbDEPENDANCES WHERE (tbDEPENDANCES.TACHEDEPART = """ & myTACHE & """);"
Set myDAOREC = myDAODB.OpenRecordset(myQuery)
mycheminsauv = myCHEMIN
Do Until myDAOREC.EOF = True
myNextTache = myDAOREC!TACHEARRIVEE
myCHEMIN = myCHEMIN & myNextTache
Call mysubREC(myNextTache, myCHEMIN)
myCHEMIN = mycheminsauv
myDAOREC.MoveNext
Loop
myDAOREC.Close
Else
'on est à la fin d'un chemin...
Debug.Print myCHEMIN
End If
End Sub |
Partager