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 42 43 44 45 46 47 48 49 50 51 52 53 54
| Private Sub cmdGo_Click()
Dim oRst As DAO.Recordset
Dim oDb As DAO.Database
Set oDb = CurrentDb
Set oRst = oDb.OpenRecordset("Test", dbOpenTable)
DoCmd.SetWarnings False
DoCmd.RunSQL "delete * from Test"
DoCmd.SetWarnings True
Dim Devis As String
Dim rep As String, sousrep As String, strTmp As String
Dim blnNiv2 As Boolean
Dim blnNiv3 As Boolean
Devis = "M:\Tableaux Excel\Devis\"
rep = Dir(Devis, vbDirectory)
Do While (rep <> "")
If rep <> "." And rep <> ".." And _
(GetAttr(Devis & rep) And vbDirectory) = vbDirectory Then
blnNiv2 = False
sousrep = Dir(Devis & rep & "\", vbDirectory)
Do While (sousrep <> "")
If sousrep <> "." And sousrep <> ".." And _
(GetAttr(Devis & rep & "\" & sousrep) And vbDirectory) = vbDirectory Then
blnNiv2 = True
oRst.AddNew
oRst.Fields("Nom dossier").Value = rep
oRst.Fields("Nom fichier").Value = sousrep
oRst.Update
End If
sousrep = Dir
Loop
If blnNiv2 = False Then
oRst.AddNew
oRst.Fields("Nom fichier").Value = rep
oRst.Update
End If
' Synchro
strTmp = Dir(Devis, vbDirectory)
Do While strTmp <> rep
strTmp = Dir
Loop
End If
rep = Dir
Loop
oRst.Close
oDb.Close
Set oRst = Nothing
Set oDb = Nothing
End Sub |
Partager