bonjour,
mon code bloque sur qui pointe sur un serveur
(erreur 52 nom ou numéro de fichier incorrect)
alors que si je mets ça fonctionne
comment faire pour atteindre et lister sur un serveur ?
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
| Private Sub test()
Dim MyFile, MyPath, MyName
Dim oDb As DAO.Database
Dim oRs As DAO.Recordset
Dim Sql As String
DoCmd.SetWarnings False
Sql = "delete from Liste_Rep"
DoCmd.RunSQL Sql
Set oDb = CurrentDb
Set oRs = oDb.OpenRecordset("Liste_Rep")
MyPath = "\\serveur\"
MyName = Dir(MyPath, vbDirectory)
Do While MyName <> "" ' Commence la boucle.
If MyName <> "." And MyName <> ".." Then
If (GetAttr(MyPath & MyName) _
And vbDirectory) = vbDirectory Then
With oRs
.AddNew
!Repert = MyName
.Update
End With
End If
End If
MyName = Dir
Loop
oRs.Close
oDb.Close
Set oRs = Nothing
Set oDb = Nothing
End Sub |
merci
bonne journée
Partager