Results 1 to 2 of 2
  1. #1
    Remster is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Sep 2010
    Posts
    317

    Sorting/filtering by year and then month

    Folks



    I need some help on how to work with dates in the following scenario.

    I have a database of documents, each of which has a review date, e.g.
    Document 1: 02/02/10 [dd/mm/yy]
    Document 2: 12/12/09
    The reviewer needs to be notified on the first of the month preceding the review date, so
    Document 1: 01/01/10
    Document 2: 01/11/09
    I'm generating these notification dates using DateSerial(Year([ReviewDate]),Month([ReviewDate])-1,1). However, I can't get these dates to sort properly: Access is sorting them by day, then month, then year. I need them sorted by year, then month, then day.

    How would this normally be handled?

    Remster

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    I would insert three fields into my query. Each is an expression.
    I would enter them in the first three columns of the query.
    First one. RYear: Year(ReviewDate)
    Second Field. RMonth: Month(ReviewDate)
    Third Field. RDay: Day(ReviewDate)

    Set each to sort Ascending and make sure the check box is unchecked. This will assure proper sorting without displaying the three helper columns.

    Alan

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Sorting by month and day - without year
    By TracyBell in forum Access
    Replies: 3
    Last Post: 11-17-2011, 10:29 AM
  2. Separating a date into day, month and year
    By teirrah1995 in forum Reports
    Replies: 3
    Last Post: 07-17-2011, 02:17 PM
  3. Replies: 1
    Last Post: 04-12-2011, 06:45 PM
  4. default month and year
    By beefyalby in forum Forms
    Replies: 3
    Last Post: 12-05-2010, 11:40 PM
  5. by year by month
    By nkuebelbeck in forum Reports
    Replies: 21
    Last Post: 03-24-2010, 01:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums