Hi - I have a form which accepts a start and end date in 2 unbound textboxes. A 3rd textbox allows the user to select the status of te incident. On clicking a command button, I can open a subform which displays each matching record:
Dim strWhere As String
Dim ststatus As String
ststatus = Me.txtStatus
If ststatus = "*" Then
strWhere = "[Incident date] Between " & Format(Me.startdate, "\#mm\/dd\/yyyy\#") & " And " & Format(Me.enddate, "\#mm\/dd\/yyyy\#")
Else
strWhere = "[Incident date] Between " & Format(Me.startdate, "\#mm\/dd\/yyyy\#") & " And " & Format(Me.enddate, "\#mm\/dd\/yyyy\#") & " And " & "[Status] = '" & txtStatus & "'"
End If
DoCmd.OpenForm "qryIncident Subform", acViewNormal, , strWhere
I want to be able to include a command button on the subform to allow the user to print a report of all matching records. The query is called QryIncidentdates, and has the following criteria in the [INCIDENTDATE] field:
Between [forms]![frmPREVIEWDATES]![startdate] And [forms]![frmPREVIEWDATES]![enddate]
When I run the query, I get no matching records - could anyone help?
Thanks - John
Dim strWhere As String
Dim ststatus As String
ststatus = Me.txtStatus
If ststatus = "*" Then
strWhere = "[Incident date] Between " & Format(Me.startdate, "\#mm\/dd\/yyyy\#") & " And " & Format(Me.enddate, "\#mm\/dd\/yyyy\#")
Else
strWhere = "[Incident date] Between " & Format(Me.startdate, "\#mm\/dd\/yyyy\#") & " And " & Format(Me.enddate, "\#mm\/dd\/yyyy\#") & " And " & "[Status] = '" & txtStatus & "'"
End If
DoCmd.OpenForm "qryIncident Subform", acViewNormal, , strWhere
I want to be able to include a command button on the subform to allow the user to print a report of all matching records. The query is called QryIncidentdates, and has the following criteria in the [INCIDENTDATE] field:
Between [forms]![frmPREVIEWDATES]![startdate] And [forms]![frmPREVIEWDATES]![enddate]
When I run the query, I get no matching records - could anyone help?
Thanks - John