Private Sub ListBox1_Click()
Dim LaDate As Date, C As Byte
If ListBox1.ListIndex = -1 Then Exit Sub
'If ListBox1.ListIndex = -1 Or ListBox1.List(ListBox1.ListIndex, 13) = "" Then Exit Sub
Me.Frame1.Visible = False
Me.Frame2.Visible = False
Me.Frame3.Visible = False
Me.Frame1.BackColor = &H8000000F
Me.Frame2.BackColor = &H8000000F
Me.Frame3.BackColor = &H8000000F
LaDate = CDate(ListBox1.List(ListBox1.ListIndex, 13) + 30)
If CDate(TextBox1) > LaDate Then
TextBox1.BackColor = RGB(255, 0, 255) 'blanc
CommandButton1.Visible = True 'False
Label1.Visible = True 'False
Else
TextBox1.BackColor = RGB(255, 255, 255) 'rose
CommandButton1.Visible = False 'True
Label1.Visible = False 'True
End If
X = Date - ListBox1.List(ListBox1.ListIndex, 13)
If X > 30 Then
Me.Frame1.BackColor = &HFFFF&
Me.Frame1.Visible = True
End If
If X > 45 Then
Me.Frame2.BackColor = &H80FF&
Me.Frame2.Visible = True
End If
If X > 60 Then
Me.Frame3.BackColor = &HFF&
Me.Frame3.Visible = True
End If
'afficher la ligne de la listbox sélectionnée dans les textbox
'içi les 6 1ères colonnes,index 0 à 5
For C = 2 To 30
Controls("TextBox" & C) = ListBox1.List(ListBox1.ListIndex, C - 2)
Next C
End Sub