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 41 42 43
| Private Sub cmd_mod_Click()
'-------------------------------------Commande modifier/client-------------------------------------------
On Error GoTo erreur1
If txtcode = "" Then
y = MsgBox("Saisir d'abord le code Client", vbCritical, "Erreur !")
txtcode.SetFocus
Else
ado_client.RecordSource = "select * from client where code_client ='" & txtcode.Text & "'"
ado_client.Refresh
If ado_client.Recordset.RecordCount = 0 Then
x = MsgBox("Code client inexistante", vbExclamation, "Attention !")
txtcode.SetFocus
Exit Sub
Else
a = MsgBox("Etes-vous sûr de vouloir continuer la modification ?", vbQuestion + vbYesNo, "Confirmation")
If a = vbYes Then
ado_client.Recordset!code_client = txtcode
ado_client.Recordset!nom_prenom = txtnompre
ado_client.Recordset!profession = txtprof
ado_client.Recordset!adresse = txtadress
ado_client.Recordset!n_tel = txtnum
If Option1.Value = True Then
ado_client.Recordset!statut_client = Option1.Caption
Else
ado_client.Recordset!statut_client = Option2.Caption
End If
ado_client.Recordset!date_visite = dvisit
[ ado_client.Recordset.Update (c'est là où il y a l'erreur)]
Combo2 = txtcode
txtcode.Text = ""
txtnompre.Text = ""
txtprof.Text = ""
txtnum.Text = ""
txtadress.Text = ""
dvisit = Date
txtnompre.SetFocus
End If
End If
End If
Exit Sub
erreur1:
x = MsgBox("Vous ne pouvez pas modifier ni supprimer ce client, car il y a soit une consultation ou une facturation en cours pour ce client; pour ce faire il faut d'abord modifier ou supprimer la consultation ou la facture.", vbCritical, "Erreur")
End Sub |
Partager