Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / November 2006

Tip: Looking for answers? Try searching our database.

Filter based on Dates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
AshGrant - 02 Nov 2006 14:09 GMT
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.
AshGrant - 02 Nov 2006 14:23 GMT
Ok no worries ive found the solution myself, I forgot when working with
dates, to use the '#' !!!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.