Ciao a tutti,
non riesco a capire a cosa sia correlato l'errore (run time error 76 - Path does not exists).
Utilizzo un ciclo per creare una serie di cartelle in base ad alcuni record selezionati in una query.
Do Until rs.EOF
strTA_ID = rs!CarName & "\" & rs!TA
strDirectoryPath = Me.txtPathTAAmd & "\" & strTA_ID
'Debug.Print strDirectoryPath
If FileFolderExists(strDirectoryPath) = False Then MkDir strDirectoryPath
rs.MoveNext
Loop
La funzione per controllare se la cartella esiste:
Public Function FileFolderExists(strFullPath As String) As Boolean
On Error GoTo EarlyExit
If Not Dir(strFullPath, vbDirectory) = vbNullString Then FileFolderExists = True
EarlyExit:
On Error GoTo 0
End Function
L'errore che mi ritorna è provocato da
strTA_ID = rs!CarName & "\" & rs!TA
Se sostiuisco con:
strTA_ID = rs!CarName & "_" & rs!TA
le cartelle vengono create.
Il risultato è che invece che avere 1 directory per ogni carrier, quindi la directory per ogni TA, avrò un solo livello di directory:
Carrier1_TA1
Carrier1_TA2
Se riuscite ad aiutarmi a capire, vi ringrazio molto.
Corrado