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
| Private Sub Supprimer_Click()
Dim A As Integer
If IsNull(Me!Nom_emp) Then
MsgBox "Vous devez sélectionner un employé!"
Exit Sub
End If
A = DCount("*", "rCompteSuppEmpl")
If A > 0 Then
MsgBox "Suppression impossible, des enregistrements sont liés à cet employé!!"
Exit Sub
End If
A = MsgBox("Voulez-vous supprimer cet enregistrement? ", 16 + 4, " ")
If A = 6 Then
DoCmd.SetWarnings False
DoCmd.Echo False
DoCmd.RunCommand acCmdSelectRecord
If Me.NewRecord = True Then
DoCmd.RunCommand acCmdUndo
Else
' *********** L'erreur se produit ici *************
DoCmd.RunCommand acCmdDeleteRecord
' *********** *************
End If
DoCmd.Echo True
DoCmd.SetWarnings True
MsgBox "Enregistrement supprimé!"
SendKeys "+{F9}", True
Me!LstNomEmp = Null
Else
End If
End Sub |
Partager