1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Private Sub CdeR_Valider_Click()
'AVANT validation verifie que tous les champs sont remplis
If (IsNull(Texte3) Or (Texte3 = vbNullString)) Or (IsNull(Texte4) Or (Texte4 = vbNullString)) Or (IsNull(Modifiable7) Or (Modifiable7 = vbNullString)) Or (IsNull(Modifiable8) Or (Modifiable8 = vbNullString)) Then
MsgBox "La saisie des 4 champs est OBLIGATOIRE avant validation", 48, "Saisie incomplète"
Exit Sub 'Ou on se repositionne sur un champ à remplir
Else
Dim msg, style, Titre, Reponse
msg = "Confirmez-vous la saisie ?"
style = vbYesNo + vbQuestion + vbDefaultButton2
Titre = "*** Demande de confirmation ***"
Reponse = MsgBox(msg, style, Titre)
If Reponse = vbYes Then
Dim sSQL As String
sSQL = "INSERT INTO MaTable(Champ1,Champ2,Champ3,Champ4,Champ5)"
& "values(texte0,texte3,texte4,Modifiable7,Modifiable8)"
DoCmd.RunSQL sSQL
MsgBox "Création réussie " , vbInformation
DoCmd.Close
End If
End If
End Sub |
Partager