G
Guest
I have cmdbegin and cmdend controls in my form. In a button on the same form
I need to write code that will check to make sure that the difference between
cmdbegin and cmdend is not greater then 6 months. The code below seems to be
working, but I'm not sure why >5 works instead of >6. I think it probably
has something to do with the fact that my dates will always be the first day
of the month, like 12/1/04 & 5/1/05. Should I be writing this DateDiff
function different?
Code that works:
'check to make sure no more than 6 months of data is requested.
If DateDiff("m", cmdbegin, cmdend) > 5 Then
MsgBox "This report can only show 6 months of data...."
Exit Sub
End If
Also, I'm trying to check to make sure cmdbegin is not a date after cmdend
but I'm having no luck with that at all.
Thanks for your help.
I need to write code that will check to make sure that the difference between
cmdbegin and cmdend is not greater then 6 months. The code below seems to be
working, but I'm not sure why >5 works instead of >6. I think it probably
has something to do with the fact that my dates will always be the first day
of the month, like 12/1/04 & 5/1/05. Should I be writing this DateDiff
function different?
Code that works:
'check to make sure no more than 6 months of data is requested.
If DateDiff("m", cmdbegin, cmdend) > 5 Then
MsgBox "This report can only show 6 months of data...."
Exit Sub
End If
Also, I'm trying to check to make sure cmdbegin is not a date after cmdend
but I'm having no luck with that at all.
Thanks for your help.