Bonsoir,
De quelle façon il est possible d'avoir deux boutons identiques dans mon formulaire avec la même fonction qui est d'inscrire un usager dans ma source ? Est-il possible d'utiliser deux fois le même code ou plutôt modifier mon code existant :
'Inscrire dans la source
Private Sub Boutoninscrire2_Click()
Dim rcell As Range
Dim NbLig As Integer
With Sheets("Inscriptions")
.Activate
If .Range("Tableau12").Rows.Count > 19 Then
MsgBox "Tableau complet", vbOKOnly + vbInformation, "COMFIRMATION"
Unload Me
Exit Sub
End If
If Bassins = "" Or ChoixRLS = "" Or NUM = "" Or nomprenom = "" Or choixlangue = "" Or _
TextBox12 = "" Or datenaissance = "" Or typedemande = "" Or IntPivot = "" Or _
profilintervention = "" Or profilisosmaf = "" Or oemcdate = "" Then
MsgBox ("Tous les champs ne sont pas correctement remplis")
Exit Sub
End If
.Unprotect Password:="CES"
With .ListObjects("Tableau12")
If .InsertRowRange Is Nothing Then '...................................si le tableau comporte des données
Set rcell = .HeaderRowRange.Cells(1).Offset(.ListRows.Count + 1) '....1ère cellule vide (colonne 1 du tableau,nombre de lignes du tableau+1)
Else
Set rcell = .InsertRowRange.Cells(1) '................................1ère cellule colonne 1 du tableau
End If
End With
.Cells(rcell.Row, 2) = Bassins.Value
.Cells(rcell.Row, 3) = ChoixRLS
.Cells(rcell.Row, 4) = NUM
.Cells(rcell.Row, 5) = nomprenom
.Cells(rcell.Row, 6) = choixlangue
.Cells(rcell.Row, 7) = TextBox12
.Cells(rcell.Row, 8) = datenaissance
.Cells(rcell.Row, 9) = typedemande
.Cells(rcell.Row, 10) = IntPivot
.Cells(rcell.Row, 11) = profilintervention
.Cells(rcell.Row, 12) = profilisosmaf
.Cells(rcell.Row, 13) = Format(Me.oemcdate.Value, "YYYY/MM/DD")
.Protect Password:="CES"
End With
MsgBox "Les informations ont été ajoutés à la base de donnée", vbOKOnly + vbInformation, "COMFIRMATION"
End Sub
End Sub
Mon premier bouton Boutoninscrire et mon deuxième bouton Boutoninscrire2
Merc !