Private Sub TextCode_Change()
If Not EnableEvents Then Exit Sub
Dim Ctrl As Control
Dim Trouve As Range
Set Trouve = Range("t_Noms[Code]").Find(Me.TextCode, lookat:=xlWhole)
If Not Trouve Is Nothing Then Me.T_bx_Noms = Trouve.Offset(0, 1)
With Range("t_Saisie").ListObject
Set Trouve = .ListColumns("Code agent").Range.Find(Me.TextCode, lookat:=xlWhole)
If Not Trouve Is Nothing Then
Me.Tbx_DebMat.Value = Format(Trouve.Offset(0, 3), "hh:mm")
Me.Tbx_FinMat.Value = Format(Trouve.Offset(0, 4), "hh:mm")
Me.Tbx_DebAPM.Value = Format(Trouve.Offset(0, 5), "hh:mm")
Me.Tbx_FinAPM.Value = Format(Trouve.Offset(0, 6), "hh:mm")
Me.Tbx_DebSoir.Value = Format(Trouve.Offset(0, 7), "hh:mm")
Me.Tbx_FinSoir.Value = Format(Trouve.Offset(0, 8), "hh:mm")
Me.T_bx_Commentaire = Trouve.Offset(0, 9)
For Each Ctrl In Me.Frame2.Controls
If TypeName(Ctrl) = "TextBox" Then
If Left(Ctrl.Name, 4) = "Tbx_" Then
Nom = Replace(Ctrl.Name, "Tbx_", "")
Ctrl.Enabled = (Ctrl.Value = "")
Me.Frame2.Controls("Chk_" & Nom).Enabled = (Ctrl.Value = "")
Me.Frame2.Controls("Chk_" & Nom).Visible = (Ctrl.Value = "")
End If
End If
Next Ctrl
End If
End With
If Me.Tbx_FinMat.Enabled = False Then
Me.Chk_DebMat.Enabled = False
Me.Chk_DebMat.BackColor = RGB(255, 0, 0)
Else
Me.Chk_DebMat.BackColor = RGB(160, 255, 255)
End If
If Me.Tbx_FinAPM.Enabled = False Then
Me.Chk_DebAPM.Enabled = False
Me.Chk_DebAPM.BackColor = RGB(255, 0, 0)
Else
Me.Chk_DebAPM.BackColor = RGB(160, 255, 255)
End If
If Me.Tbx_FinSoir.Enabled = False Then
Me.Chk_DebSoir.Enabled = False
Me.Chk_DebSoir.BackColor = RGB(255, 0, 0)
Else
Me.Chk_DebSoir.BackColor = RGB(160, 255, 255)
End If
Me.Lbx_Information.Caption = "Vous ne pouvez plus badger"
CalculerTotalJournée
End Sub