Hi all,
I have an issue with a report I'm working on. The report is to display all records between two dates. These dates are determined by the date() function and stored as variables. When my code runs, the dates populate fine and my SQL looks right but I don't know how to get the results to display. Any help here would be greatly appreciated.
Here's my code
I have an issue with a report I'm working on. The report is to display all records between two dates. These dates are determined by the date() function and stored as variables. When my code runs, the dates populate fine and my SQL looks right but I don't know how to get the results to display. Any help here would be greatly appreciated.
Here's my code
Code:
Private Sub Report_Open(Cancel As Integer)
Dim endDate As Date
Dim startDay As Integer
Dim startMonth As Integer
Dim startYear As Integer
endDate = Date
startDay = day(Date)
startMonth = month(Date)
startYear = year(Date)
startDay = startDay - 4
Dim startDate As Date
startDate = startDay & "/" & startMonth & "/" & startYear
startDate = CDate(startDate)
Dim strSQLSel As String
strSQLSel = "SELECT date_due, page_file_name, section_name, primary_contact_name, description, completed FROM update_html WHERE ((date_due <= " & startDate & ") And (date_due >= " & endDate & ")) And (completed = Yes) ORDER BY update_html.date_due DESC"
'MsgBox (strSQLSel)
DoCmd.RunSQL (strSQLSel)
End Sub