Andrew
October 29th, 1999, 11:12 AM
In a series of "if - then - else" statements I have the following block of code to advance the value of a Date variable by 1 or more months depending on user input.
If Month(DateValue) = 1 then
DateValue = DateValue + 31
ElseIf Month(DateValue) = 2 then
If Year(DateValue) \ 4 = 0 then
MsgBox Year(DateValue)
FechaValue = DateValue + 29
else
FechaValue = DateValue + 28
End If
et cetera
Everything works fine except for the month of February during a leap year. The program never enters the first portion of the If - Then - Else statement
If Year(DateValue) \ 4 = 0 then
This is supposed to return the remainder of the year value divided by 4 and add 29 days rather than 28 if the remainder is 0. I thought that I might have the syntaxt for the remainder function wrong, but I never receive a compile or run-time errror of any type, it just never enters the statement.
Anyone have an idea? thanks
Andrew
If Month(DateValue) = 1 then
DateValue = DateValue + 31
ElseIf Month(DateValue) = 2 then
If Year(DateValue) \ 4 = 0 then
MsgBox Year(DateValue)
FechaValue = DateValue + 29
else
FechaValue = DateValue + 28
End If
et cetera
Everything works fine except for the month of February during a leap year. The program never enters the first portion of the If - Then - Else statement
If Year(DateValue) \ 4 = 0 then
This is supposed to return the remainder of the year value divided by 4 and add 29 days rather than 28 if the remainder is 0. I thought that I might have the syntaxt for the remainder function wrong, but I never receive a compile or run-time errror of any type, it just never enters the statement.
Anyone have an idea? thanks
Andrew