I have a report that is filtered by date using a form with unbound text boxes. The user enters the beginning and ending dates and the report criteria looks at the text boxes for the values of the Between/And operator.
The problem that I am having is that when I enter 1/1/2013 and 1/31/2013 for the dates, any record with a date of 1/31/2013 is not included in the report. However, if I put in 2/1/2013 I get the 1/31/2013 records AND the 2/1/2013 records.
Has anybody seen this or have a solution?
Here is my code:
Private Sub cmdSubmit_Click()
On Error GoTo Err_Handler
If IsNull(Me!dtStartDate.Value) Then
Me!dtStartDate.Value = "1/1/2000"
End If
If IsNull(Me!dtEndDate.Value) Then
Me!dtEndDate.Value = Date + 1
ElseIf Me!dtEndDate.Value = Date Then
Me!dtEndDate.Value = Date + 1
End If
DoCmd.OpenReport "rptreceivinglog", acViewPreview
Exit Sub
Err_Handler:
MsgBox Err.Description, , "Submit Fail"
Exit Sub
End Sub
Code for the BETWEEN/AND operator used in the Report SQL:
Between [Forms]![frmReceivingLogReportDates]![dtStartDate] And [Forms]![frmReceivingLogReportDates]![dtEndDate]