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
| Public Sub creer_dossiers(No_affaire As Long, No_prospect As String)
On Error GoTo Err_creer_dossiers
Dim db As DAO.Database, rst As DAO.Recordset, fld As DAO.Field
Dim sSQL As String
' Ouverture de la base de données
Set db = CurrentDb
sSQL = "SELECT N_PROSPECT, NOM_CLIENT FROM CLIENT where N_PROSPECT = " & No_prospect
' Ouverture du recordset
Set rst = db.OpenRecordset(sSQL)
Nom_prospect = rst![nom_client]
creer = MsgBox("êtes vous sur de vouloir créer les dossiers pour cette affaire ?", vbYesNo)
If creer = 6 Then
mypath = Chemin_Base
Année = "Affaires 200" & Left(No_affaire, 1)
chemin = "\" & Left(No_affaire, 1) & "." & Right(No_affaire, 4) & Space(1) & Nom_prospect
MsgBox mypath & Année & chemin
MkDir mypath & Année & chemin
MkDir mypath & Année & chemin & "\" & chemin & " photos"
MkDir mypath & Année & chemin & "\" & chemin & " etudes"
MkDir mypath & Année & chemin & "\" & chemin & " technique"
MkDir mypath & Année & chemin & "\" & chemin & " administratif"
MsgBox "dossiers créés"
End If
' Fermeture du Recordset
rst.Close
Exit_creer_dossiers:
Exit Sub
Err_creer_dossiers:
MsgBox Err.Description
Resume Exit_creer_dossiers
End Sub |
Partager