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 MiseJour_Click()
Dim maBD As Database
Dim reqSQL As String
Dim choix As Integer
Dim Nb As Variant
Dim AnneedAchat As Variant
Dim x As Variant
'Commentaires : récupération de la base donnée courante
Set maBD = CurrentDb()
AnneedAchat = InputBox("Veuillez saisir l'année des Dvd à modifier : ")
Nb = InputBox("Veuillez saisir un pourcentage pour modifier le Prix de Vente : ")
If AnneedAchat = "" Or Nb = "" Then 'l'utilisateur a rien mis dans Nom
choix = MsgBox("Vous n'avez rien rentré, Aucune Insertion effectuée ! ", vbOKOnly + vbExclamation, "Erreur dans l'insertion")
If choix = vbOKOnly Then
Exit Sub
End If
Else:
reqSQL = "UPDATE DVD SET PrixVente = PrixVente * (1 + (Nb) / 100) WHERE AnneeAchat = AnneedAchat ;"
'reqSQL = reqSQL & " VALUES ('" & x & "');"
MsgBox reqSQL
maBD.Execute reqSQL
DoCmd.Save
RefreshDatabaseWindow
MsgBox ("Nombre de ligne modifiées : " + Str(maBD.RecordsAffected))
End If
End Sub |
Partager