Private Sub Bt_Ajout_Click()
'si tous les controles sont renseignés
Dim Ctrl As Control
For Each Ctrl In Me.Controls
If (TypeOf Ctrl Is MSForms.TextBox Or TypeOf Ctrl Is MSForms.ComboBox) Then
If Ctrl.Name <> "com_mvt" And Ctrl.Name <> "com_lot" Then
If Ctrl.Object.Value = "" Then
MsgBox "Complétez les contrôles!"
Exit Sub
End If
End If
End If
Next Ctrl
'on alimente la listbox
Me.ListBox1.AddItem Me.date_mvt
n = Me.ListBox1.ListCount - 1
Me.ListBox1.List(n, 1) = Me.num_trav
Me.ListBox1.List(n, 2) = Me.num_nat
Me.ListBox1.List(n, 3) = CDate(Me.animal_date_naissance)
Me.ListBox1.List(n, 4) = Me.lieu_mvt
Me.ListBox1.List(n, 5) = Me.animal_race
Me.ListBox1.List(n, 6) = Me.animal_sexe
Me.ListBox1.List(n, 7) = Me.animal_mere
Me.ListBox1.List(n, 8) = Me.animal_pere
Me.ListBox1.List(n, 9) = Me.com_mvt
If autaureau.Value = True Then
Me.ListBox1.List(n, 10) = CDate(Me.date_mvt)
End If
'on vide les controles (sauf lieu de mvt et date de mvt)
For Each Ctrl In Me.Controls
If (TypeOf Ctrl Is MSForms.TextBox Or TypeOf Ctrl Is MSForms.ComboBox Or TypeOf Ctrl Is MSForms.CheckBox) Then
If Ctrl.Name <> "lieu_mvt" And Ctrl.Name <> "date_mvt" And Ctrl.Name <> "com_lot" Then
Ctrl.Object.Value = ""
End If
End If
Next Ctrl
End Sub