To easily be able to derive the last day of the current month, you can create a new module, name it something like mdlLastDayofTheMonth, and voila--there you go. The module:
Function LastDayofMonth(datTestDate As Date) As Date Dim intMonth As Integer, intYear As Integer intMonth = Month(datTestDate) Mod 12 + 1 intYear = Year(datTestDate) LastDayofMonth = DateSerial(intYear, intMonth, 1) - 1 End Function |
Then, the code to return, say, 12/31/2002 or 2/29/2000 etc would be (important part bolded):
Me.txtEndDate = LastDayofMonth(Date)Unlike how it looks, the above function returns the entire date with the proper ending date included; it does not return just the last day of the month by itself.