Hello everyone,
I have a form that is connected to a table called floods that has a date column as mm/dd/yyyy. I want to filter my form but only by the year. When I try to filter it nothing happens, i don't even get an error. Below is the code if anyone could help in this matter it would be greatly appreciated.
Thanks
I have a form that is connected to a table called floods that has a date column as mm/dd/yyyy. I want to filter my form but only by the year. When I try to filter it nothing happens, i don't even get an error. Below is the code if anyone could help in this matter it would be greatly appreciated.
Thanks
Code:
Me.FindYear = IIf(IsDate(Me.FindYear), _
Format(Me.FindYear, " yyyy"), "")
Dim strFilter As String, strOldFilter As String
strOldFilter = Me.Filter
'txtFind - Date
If Me.FindYear > "" Then _
strFilter = strFilter & _
" ([eventdatestart BETWEEN #1/1/yyyy# AND #12/31/yyyy#]=" & _
Format(CDate(Me.FindYear), _
"\#m/d/yyyy\#") & ")"
If strFilter > "" Then strFilter = Mid(strFilter, 6)
If strFilter <> strOldFilter Then
Me.FilterOn = (strFilter > "")
Me.Filter = strFilter
End If
Comment