Tuesday, June 7, 2011

Remove weekend days from list of days MS access

One of the things that I faced, was how to remove the weekend dates from a list of days.
The solution was simple.
use the function:
DatePart 
This function is fully listed in the following link:
http://www.techonthenet.com/access/functions/date/datepart.php

What I did is the following to remove Sunday and Saturday.
the DatePart returns a number between 1(Sunday)-7 (Saturday)
so I did:
where DatePart("w",(DayColumnInDays.MM/DD/YYYY))<=6 And DatePart("w",(DayColumnInDays.MM/DD/YYYY))>1

This is how I removed the weekends

No comments:

Post a Comment