Private Sub Valider_et_saisir_Click()
Application.ScreenUpdating = False
Call Module3.Déprotege
With Sheets("Base de données")
With .ListObjects("Tbase")
.ListRows.Add 'ajoute une ligne à la table "TBase")
With .DataBodyRange
lastline = .Rows.Count 'récupère le nombre de ligne au total ==> la dernière est vide
.Cells(lastline, 2) = Me.Txtinitiales
.Cells(lastline, 3) = Me.Txtnom
.Cells(lastline, 4) = Me.Txtprenom
.Cells(lastline, 6) = Me.Txtentreprise
.Cells(lastline, 7) = Format(Me.Txtsiret.Value, 0)
.Cells(lastline, 8) = Me.Cbxopco
.Cells(lastline, 10) = DateValue(Me.Txtdebut) ', "dd/mm/yyyy") 'format de date
.Cells(lastline, 11) = DateValue(Me.Txtfin) ', "dd/mm/yyyy") 'format de date
.Cells(lastline, 23) = Me.Cbxdiplome
.Cells(lastline, 24) = Me.Cbxsite
End With
End With
End With
With Sheets("thr")
With .ListObjects("Tthr")
.ListRows.Add
With .DataBodyRange
lastline = .Rows.Count
.Cells(lastline, 2) = Me.Txtnom
.Cells(lastline, 3) = Me.Txtprenom
.Cells(lastline, 30) = Format(Me.Txtfin, "dd/mm/yyyy") 'format de date
End With
End With
End With
With Sheets("caisse à outils")
With .ListObjects("Tcaisse")
.ListRows.Add
With .DataBodyRange
lastline = .Rows.Count
.Cells(lastline, 2) = Me.Txtnom
.Cells(lastline, 3) = Me.Txtprenom
.Cells(lastline, 4) = Me.Cbxdiplome
.Cells(lastline, 5) = Me.Cbxsite
.Cells(lastline, 7) = Me.Txtalertecaisse
.Cells(lastline, 18) = Format(Me.Txtfin, "dd/mm/yyyy") 'format de date
End With
End With
End With
Application.ScreenUpdating = True
Me.Txtinitiales = "" 'la valeur de la celulle active est = a la textbox de ce formulaire(me)
Me.Txtnom = ""
Me.Txtprenom = ""
Me.Txtentreprise = ""
Me.Txtsiret = ""
Me.Cbxopco = ""
Me.Txtdebut = ""
Me.Txtfin = ""
Me.Cbxdiplome = ""
Me.Cbxsite = ""
Me.Txtalertecaisse = ""
End Sub