Any suggestions to how I can filter records by months of the year rather than by the day?
This is the search function method I currently use which does it by the day of the month
The dat/time field is set to short date.
CODE
Private Sub cmdSearch_Click()
'Set the Dimensions of the Module
Dim strSql As String, strOrder As String, strWhere As String
Dim dbNm As Database
Dim qryDef As QueryDef
Set dbNm = CurrentDb()
strSql = "SELECT PPMControlAll.DateReported " & _
"FROM qryPPMControlAll"
strWhere = "WHERE"
If Not IsNull(Me.txtDateReported) Then
strWhere = strWhere & " (qryPPMControlAll.DateReported) Like '*" & Me.txtDateReported & "*' AND"
End If
'Remove the last AND from the SQL statment
strWhere = Mid(strWhere, 1, Len(strWhere) - 5)
'Pass the SQL to the RowSource of the listbox
Me.lstTasks.RowSource = strSql & " " & strWhere & "" & strOrder
End Sub
'Set the Dimensions of the Module
Dim strSql As String, strOrder As String, strWhere As String
Dim dbNm As Database
Dim qryDef As QueryDef
Set dbNm = CurrentDb()
strSql = "SELECT PPMControlAll.DateReported " & _
"FROM qryPPMControlAll"
strWhere = "WHERE"
If Not IsNull(Me.txtDateReported) Then
strWhere = strWhere & " (qryPPMControlAll.DateReported) Like '*" & Me.txtDateReported & "*' AND"
End If
'Remove the last AND from the SQL statment
strWhere = Mid(strWhere, 1, Len(strWhere) - 5)
'Pass the SQL to the RowSource of the listbox
Me.lstTasks.RowSource = strSql & " " & strWhere & "" & strOrder
End Sub
I just need to know how to group them all together by using a combo box that list all 12 months of the year & once a month is selected it will group all the relevant records together.
Any help would be greatly appreciated
Thanks
