I am trying to create a report by selecting three date fields from one
table with records between a start date and end date. I have tried to
adapt one of Allen Browne's scripts as follows but it gives me records
outside my date criteria - I guess my strSelect is wrong! I tried
strSelect = * but that didn't work either.
Private Sub CmndOK_Click()
Dim strReport As String 'Name of report to open.
Dim strWhere As String 'Where condition for OpenReport.
Dim strSelect As String
Dim strFrom As String
Const conDateFormat = "\#mm\/dd\/yyyy\#"
strReport = "TermDeposits"
strSelect =
"Termdeposits.TermDeposit1MaturityDate,Termdeposit s.TermDeposit2MaturityDate,Termdeposits.TermDeposi t3MaturityDate"
strWhere = strSelect & " Between " &
Format(Me.txtStartDate, conDateFormat) & " And " &
Format(Me.txtEndDate, conDateFormat)
' Debug.Print strWhere 'For debugging
purposes only.
DoCmd.OpenReport strReport, acViewPreview, , strWhere
End Sub