Hi, i made a form where i calculate difference between dates.
Sometimes days are negative numbers. When days are negative numbers i need to make days + 30 or days +31?
I mean this : " If tdays < 0 then tdays = tdays +30" or " If tdays < 0 then tdays = tdays +31" ?
Thank you!
Code:
..............
Dim tyears As Integer, tmonths As Integer, tdays As Integer
tyears = Year(Me!txtdata1) - Year(Me!txtdata2)
tmonths = Month(Me!txtdata1) - Month(Me!txtdata2)
tdays = Day(Me!txtdata1) - Day(Me!txtdata2)
If tmonths < 0 Then
tyears = tyears - 1
tmonths = tmonths + 12
End If
If tyears < 0 Then tyears = 0
If tdays < 0 Then tmonths = tmonths - 1
MsgBox (tyears & "years" & tmonths & "months" & tdays & "days")
..................
Sometimes days are negative numbers. When days are negative numbers i need to make days + 30 or days +31?
I mean this : " If tdays < 0 then tdays = tdays +30" or " If tdays < 0 then tdays = tdays +31" ?
Thank you!