Private Sub TextBox1_AfterUpdate()
Tmp = Me.TextBox1.Value
Nba = Year(Date) - Year(Tmp)
Nbm = Month(Date) - Month(Tmp)
Nbj = Day(Date) - Day(Tmp)
Nb = Day(DateSerial(Year(Date), Month(Date), 0))
Pan = Day(Tmp) & "/" & Month(Tmp) & "/" & Year(Date)
Pan1 = DateAdd("yyyy", 1, Pan)
If Month(Date) < Month(Tmp) Or (Month(Date) = Month(Tmp) And Day(Date) < Day(Tmp)) Then
Me.TextBox2.Value = Year(Date) - Year(Tmp) - 1 & " " & "ans"
Else
Me.TextBox2.Value = Year(Date) - Year(Tmp) & " " & "ans"
End If
If Nbj < 0 Then
Nbm = Nbm - 1
Nbj = Nbj + Nb
End If
If Nbm < 0 Then
Nba = Nba - 1
Nbm = Nbm + 12
End If
Me.TextBox5.Value = Nba & " " & "ans," & " " & Nbm & " " & "mois," & " " & Nbj & " " & "jours."
Me.TextBox3.Value = DateDiff("m", Tmp, Date) & " " & "mois"