Hello Everyone,
I'm creating a form in access that is connected with a table that has a date column as mm/dd/yyyy. I want to filter the form but just by the year. When I try to do this with the code I have nothing happens not even an error message. Below is the code that I have, any help on this would be greatly appreciated.
Thanks
Code:
Private Sub FindYear_AfterUpdate()
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 & _
" AND ([eventdatestart]=" & _
Format(CDate(Me.FindYear), _
"\#m/d/yyyy\#") & ")"
If strFilter > "" Then strFilter = Mid(strFilter, 6)
If strFilter <> strOldFilter Then
Me.Filter = strFilter
Me.FilterOn = (strFilter > "")
End If
End Sub