1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Private Sub cmdDupliquer_Click()
Dim blnCondition As Boolean
blnCondition = (Me!MonChampAVerifier = "Le truc que je veux vérifier")
If blnCondition = True Then
DupliquerEnregistrement Me!Champ1, Me!Champ2, Me!Champ3, 0, False, 0, "", Me!Champ4
Else
MsgBox "Il n'est pas possible de dupliquer cet enregistrement"
End If
End Sub
Private Sub DupliquerEnregistrement(nChp1, nChp2, nChp3, nChp4, nChp5, bChp6, sChp7, sChp8)
Dim SQLInsert As String
SQLInsert = "INSERT INTO MaTable (Champ1,Champ2,Champ3,Champ4,Champ5,Champ6,Champ7,Champ8) VALUES ("
SQLInsert = SQLInsert & nChp1 & ", " & nChp2 & ", " & nChp3 & ", " & nChp4 & ", " & nChp5 & ", " & bChp6 & ", " & Chr(34) & sChp7 & Chr(34) & ", " & Chr(34) & sChp8 & Chr(34) & ")"
CurrentDb.Execute SQLInsert, dbSeeChanges
End Sub |
Partager