Filter based on Dates

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi there. I am trying to filter a form based on a table "TASKS"
I have a drop down box where the user can select to view all tasks starting
in the current week and previous week, and then to filter the data
accordingly.
This is my code so far on AfterUpdate event of the combo box:

If Combo30 = "This Weeks" Then
Dim begdate As Date
Dim enddate As Date
begdate = Format(Date - Weekday(Date) + 1, "mm/dd/yyyy")
enddate = Format(Date - Weekday(Date) + 7, "mm/dd/yyyy")
Me.Filter = "(STARTDATE Between ' " & begdate & " ' And ' " & enddate & " ')"
Me.FilterOn = True
End If

When running the code it returns the following error message:
"You cancelled the previous operation"

Can't work this one out, thanks for any help in advance.
Ash.
 
Ok no worries ive found the solution myself, I forgot when working with
dates, to use the '#' !!!
 
Back
Top