OK, I have a form that has a button on. When that button is clicked it launches a report. This report should only contain records where the date stored in CourseMotivateDate is before today's date.
How can I do the date comparison? I tried simply using "[CourseMotivateDate] < " & Date but that didn't work.
I have pasted my Event Procedure below. It is the final bit of code to complete stReportFilterCriteria that I am missing. Is it something to do with the wya the date is stored and the way it is displayed? CourseMotivateDate is stored as a ShortDate data type.
Code:
Private Sub CompletedCourses_Click()
On Error GoTo Err_CompletedCourses_Click
Dim stDocName As String
Dim stReportFilterCriteria As String
stDocName = "Courses"
stReportFilterCriteria = "[CourseMotivateDate] < " & "DATE COMPARISON"
Debug.Print stReportFilterCriteria
DoCmd.OpenReport stDocName, acPreview, , stReportFilterCriteria
Exit_CompletedCourses_Click:
Exit Sub
Err_CompletedCourses_Click:
MsgBox Err.Description
Resume Exit_CompletedCourses_Click
End Sub