"Merle Nicholson" <me******@tampabay.rr.com> wrote in message
news:QK******************@twister.tampabay.rr.com. ..
Here's what I use.
Public Function LastDayInMonth(ByVal AnyDate As Date) As Date
' ************************************************** **********
' Given any valid date, returns the last day of that month
' *****************************
LastDayInMonth = DateAdd("m", 1, CDate(Month(AnyDate) & "/01/" &
Year(AnyDate))) - 1
End Function
Merle: I'd strongly suggest changing your function to:
Public Function LastDayInMonth(ByVal AnyDate As Date) As Date
' ************************************************** **********
' Given any valid date, returns the last day of that month
' *****************************
LastDayInMonth = DateAdd("m", 1, DateSerial(Year(AnyDate),
Month(AnyDate), 1) - 1
End Function
The CDate function respects the user's date format settings. Anyone using
your function who has their Short Date set to dd/mm/yyyy will get incorrect
results.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele