Hi
How can I check from a given year if feb has 28 days or 29?
Thanks
Regards
In what context? When? Where? Why?
If you attempt to enter a date of 2/29/someyear Access will not accept
it if it is not a leap year. that should tell you right there.
However...
Here is a function you can use.
Copy and paste it into a module.
Function IsLeapYear() as String
On Error GoTo Err_Handler
Dim strYear As String
strYear = InputBox("Enter the year to be checked.", , Year(Date))
strYear = "2/29/" & strYear
Dim dteDate As Date
dteDate = CDate(strYear)
IsLeapYear = "It is a leap year."
Exit_Function:
Exit Function:
Err_Handler:
IsLeapYear = "It's NOT a leap year."
Resume Exit_Function
End Function
You can call it from the Debug window using
? IsLeapYear()
from any code window using =IsLeapYear(), or change the entry of the
year by adapting this function to your specific needs.