Date Issue for a report

CBG2112

Registered User.
Local time
Yesterday, 20:49
Joined
Aug 4, 2009
Messages
32
I have two unbound text boxes in a form called startdate and enddate. On form open, the two fields are populated with dates with the code below.

Private Sub Form_Open(Cancel As Integer)

Me.StartDAte.SetFocus
Me.StartDAte.Text = Format$(Now - 7, "MM/DD/YYYY")
Me.EndDate.SetFocus
Me.EndDate.Text = Format$(Now, "MM/DD/YYYY")

End Sub

The query for the report has a date field with the critieria
Between [Forms]![Main Menu]![StArtDate] And [Forms]![Main Menu]![EndDate]

If the fields contain 7/26/10 and 8/2/10 and I press a preview report button, the report will not include data for the latest date 8/2/10. :confused: I would have to change the date to 8/3/10. I would like to have it so that the user actually gets data for that date range shown for the startdate and enddate fields. Any help would be appreciated. Thank you.
 
Your fields are obviously Date and Time, and a date without a time defaults to 00:00:00, if you know that nothing happens at midnight just add 1 in your sub code.
Else add 23:59:59.

Question: As you Formatted for Date only why use Now instead of Date?

Brian
 

Users who are viewing this thread

Back
Top Bottom