Many people don't realize it, but Access provides a built-in method for sorting date fields by a number of different levels, such as by year, quarter, etc.
You can set all of this up by adding the date field to the Sorting and Grouping window, then clicking "Group On". The options available to you are dependent on the datatype. So, a date field will give you a number of unique grouping options, including "Year", "Qtr", "Month", "Week", "Day", "Hour", and "Minute".
Along with these date groupings, there is a function that will help you determine which day of the week a certain date is. Here is some code that will highlight the "WeekDay" function:
Dim dateTest As Date
dateTest = #3/31/2003#
MsgBox Weekday(dateTest)
'Sun=1, Mon=2, Tue=3, Wed=4, Thu=5, Fri=6, Sat=7
You will see that it returns the value of "2".
Feedback, comments?
Randy Smith, MCP
rsmith@cta.org
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.