Filter based on Dates

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.
 
G

Guest

Ok no worries ive found the solution myself, I forgot when working with
dates, to use the '#' !!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top