M
Michael
I have followed his tutorial at http://allenbrowne.com/casu-08.html and made
the from for the dates and did every step correctly (I think) and when I
click the ok button... nothing happens. The cancel button works. Also I was
wondering if I can use two calendars instead of text boxes? Below is the
code I have only altered the
strReport = "Order Details"
strField = "Data Partenza"
Do I have to make changes to my query as well or is all the filtering done
with this code? Sorry if it is a dumb question.
Michael
Private Sub Command4_Click()
Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#dd\/mm\/yyyy\#"
strReport = "Order Details"
strField = "Data Partenza"
If IsNull(Me.txtStartDate) Then
If Not IsNull(Me.txtEndDate) Then 'End date, but no start.
strWhere = strField & " < " & Format(Me.txtEndDate,
conDateFormat)
End If
Else
If IsNull(Me.txtEndDate) Then 'Start date, but no End.
strWhere = strField & " > " & Format(Me.txtStartDate,
conDateFormat)
Else 'Both start and end dates.
strWhere = strField & " Between " & Format(Me.txtStartDate,
conDateFormat) _
& " And " & Format(Me.txtEndDate, conDateFormat)
End If
End If
' Debug.Print strWhere 'For debugging purposes only.
DoCmd.OpenReport strReport, acViewPreview, , strWhere
End Sub
the from for the dates and did every step correctly (I think) and when I
click the ok button... nothing happens. The cancel button works. Also I was
wondering if I can use two calendars instead of text boxes? Below is the
code I have only altered the
strReport = "Order Details"
strField = "Data Partenza"
Do I have to make changes to my query as well or is all the filtering done
with this code? Sorry if it is a dumb question.
Michael
Private Sub Command4_Click()
Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#dd\/mm\/yyyy\#"
strReport = "Order Details"
strField = "Data Partenza"
If IsNull(Me.txtStartDate) Then
If Not IsNull(Me.txtEndDate) Then 'End date, but no start.
strWhere = strField & " < " & Format(Me.txtEndDate,
conDateFormat)
End If
Else
If IsNull(Me.txtEndDate) Then 'Start date, but no End.
strWhere = strField & " > " & Format(Me.txtStartDate,
conDateFormat)
Else 'Both start and end dates.
strWhere = strField & " Between " & Format(Me.txtStartDate,
conDateFormat) _
& " And " & Format(Me.txtEndDate, conDateFormat)
End If
End If
' Debug.Print strWhere 'For debugging purposes only.
DoCmd.OpenReport strReport, acViewPreview, , strWhere
End Sub