Reputation: 1
I am running a code based on a week number to filter for work order dates that match the week column and are greater than the WODate Column. My code gives me a "Syntax" Error for the second applyfilter command. Is there a way to have both filters apply at once? my code:
Private Sub Weeks_AfterUpdate()
DoCmd.ApplyFilter , "[Week] = '" & Me.Weeks & "'"
DoCmd.ApplyFilter , "[WODate] >= #" & Format(wodate, "mm/dd/yyy") & "# and [FYDate] <= #" & Format(todate, "mm/dd/yyyy") & "#"
Me.FilterOn = True
End Sub
Upvotes: 0
Views: 1541
Reputation: 55806
You miss a y, and the date separators should be escaped:
DoCmd.ApplyFilter , "[WODate] >= #" & Format(wodate, "mm\/dd\/yyyy") & "# and [FYDate] <= #" & Format(todate, "mm\/dd\/yyyy") & "#"
Upvotes: 1