Hi everyone, I have a continuous form where users can enter dates as seen here:
I also have this other form where users can enter a date range that will display records within that range, as seen here:
Note here that I have entered a test record with the start date being 6-Dec-12 and the end date being 8-Dec-12. I should only get back two records (one is a real record the other is this fake one I have created) but instead the result is this:
The report only gave me back the one already existing record but not the fake one. I also noticed when I went back to the form, the date fields appeared blank, even after hitting save and close).
The vba for the button to open up the reports is as follows:
Code:
Private Sub cmdAAReport1_Click()
Dim strCriteria As String
If Not IsNull(Me.txtStart1) Then
strCriteria = " And AAExpiryDate >= #" & _
Format(Me.txtStart1, "yyyy-mm-dd") & "#"
End If
If Not IsNull(Me.txtEnd1) Then
strCriteria = strCriteria & " And AAExpiryDate < #" & _
Format(Me.txtEnd1 + 1, "yyyy-mm-dd") & "#"
End If
' remove leading ' And '
strCriteria = Mid(strCriteria, 6)
' open report
DoCmd.OpenReport "rptAAExpiryDate", _
View:=acViewReport, _
WhereCondition:=strCriteria
End Sub
If anyone knows what this is and has feedback. That would be greatly appreciated!