'FromYear is the year entered by the user, extracted from the full date.
'if its not a leap year and the month is february and the user chooses the 29th of Feb the day must be overwritten with the 28th.
'if it is a leap year then it must start after the 23rd but end at 29
'Code*****
if (FromYear Mod 4 <> 0) and (FromYear Mod 100 <> 0) and (FromYear Mod 400 <>) then
if FromMonth = 2 then
if FromDay = 29 then
FromDay = 28
else FromDay = 29
end if
if FromDay > 22 then
ToDay = (FromDay + 6) - 28
ToMonth = FromMonth + 1
end if
end if
elseif FromDay > 23 and <29 then
ToDay = (FromDay + 6) - FromDay ToMonth = FromMonth + 1