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
| Private Sub btnLierPince_Click()
' Dim kPince As Long, kMatrice As Long
' If CurrentProject.AllForms("F_GestionPinces").IsLoaded Then
' kPince = Form_F_GestionPinces.Id_Pince
' kMatrice = Me.ID_Matrice
' If Nz(DCount("*", "T_PincesMatrices", "ID_Pince=" & kPince & " AND ID_Matrice=" & kMatrice), 0) = 0 Then
' If MsgBox("Ajouter cette matrice à la pince " & Form_F_GestionPinces.Ref_Fabricant & " ?", _
' vbYesNo, "A confirmer") = vbYes Then
'
' DoSQL "INSERT INTO T_PincesMatrices (ID_Pince, ID_Matrice)" & _
' " VALUES (" & kPince & ", " & kMatrice & ")"
' Form_SF_PincesMatrices.Requery
' End If
' Else
' MsgBox "Cette matrice est déjà liée à cette pince !", vbExclamation, "Annulé"
' End If
' Else
' MsgBox "Le formulaire de gestion des pinces n'est pas ouvert !", , "Annulé"
' End If
Dim kContact As Long, kPince As Long
If CurrentProject.AllForms("F_GestionContacts").IsLoaded Then
kContact = Form_F_GestionContacts.ID_Contact
kPince = Me.Id_Pince
If Nz(DCount("*", "T_ContactsPinces", "ID_Contact=" & kContact & " AND ID_Pince=" & kPince), 0) = 0 Then
If MsgBox("Ajouter cette pince au contact " & Form_F_GestionContacts.Ref_Fabricant & " ?", _
vbYesNo, "A confirmer") = vbYes Then
DoSQL "INSERT INTO T_ContactsPinces (ID_Contact, ID_Pince)" & _
" VALUES (" & kContact & ", " & kPince & ")"
Form_SF_ContactsPinces.Requery
End If
Else
MsgBox "Cette pince est déjà liée à ce contact !", vbExclamation, "Liaison Annulée"
End If
Else
MsgBox "Le formulaire de gestion des pinces n'est pas ouvert!" & vbCrLf & "Vous ne pouvez donc pas lier celle-ci.", vbInformation, "Liaison annulée"
End If
End Sub |
Partager