我正在运行基于周数的代码来过滤与周列匹配且大于WODate列的工单日期。我的代码给了我第二个applyfilter命令的“语法”错误。有没有办法让两个过滤器同时应用?我的代码:
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
你错过了一个y,日期分隔符应该被转义:
DoCmd.ApplyFilter , "[WODate] >= #" & Format(wodate, "mm\/dd\/yyyy") & "# and [FYDate] <= #" & Format(todate, "mm\/dd\/yyyy") & "#"