INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

How To

Sorting by year, quarter, month, week, day, etc. by randysmid
Posted: 6 Jan 03 (Edited 23 Oct 03)

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    

Back to Microsoft: Access Reports FAQ Index
Back to Microsoft: Access Reports Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close