My form has two text boxes, txtDateFrom and txtDateTo. A macro button with the caption Month is to automatically fill in txtDateFrom and txtDateTo with current month date. My code reads as:
what I want is this: 5/1/2009 -5/31/2009 but what I get is 5/15/2009 - 6/14/2009How can I modify this code to get This month instead of a month from today?
Thanks.
Code:
Private Sub cmdmonth_Click()
'Sets the Date From and Date To text boxes
'to show complete month (from start to end of current month)
Me!txtdatefrom = DateAdd("m", (today * -1), Date)
Me!txtDateTo = DateAdd("d", -1, DateAdd("m", 1, Me!txtdatefrom))
End Sub
Thanks.
Comment