Results 1 to 4 of 4
  1. #1
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476

    Is there any trick in getting the MNTH to run from Jan – Dec vs. alphabetically?

    I’ve believe to have really gotten the handle on manipulating the “DATE” fld to represent other formats in queries.


    Now that I’m successfully able to run my monthly queries by taking the DATE “TDATE” & formatting it in a query by: MNTH: Format([TDATE], “mmm”) I even fiqured out how to have my “MNTH” run from Jan to Dec, M: Format([TDATE], “m”) & just hide column (or check off the grid box I the query design. Now I come upon anther quandary --- let me illustrate:

    I have a query with the months, projectID, sumofhrs, sumofbilling, etc.
    - MNTH (no longer in Date/Time frmt)
    - ProjectID
    - SumOfHRS
    - SumOf…etc.

    Now. If I want to see a query with just the months sums – the ProjectID I just yank out the “ProjectID out from the query – very simple. Except my “MNTH” are in alphabetically order when I want them to run from Jan – Dec. Is there any trick in getting the MNTH to run from Jan – Dec vs. alphabetically?

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    How come MNTH is now a string?
    Create a table ...tblMonths
    tblMonths
    MnthName MnthOrder id
    Jan
    1 1
    Feb 2 2
    Mar 3 3
    Apr 4 4
    May
    5 5
    Jun 6 6
    Jul 7 7
    Aug
    8 8
    Sep
    9 9
    Oct 10 10
    Nov 11 11
    Dec 12 12

    Use this table in your query. Join your current MNTH fld to MnthName.
    Select MnthOrder in the query, order your query on MnthOrder.
    Last edited by orange; 11-30-2011 at 06:59 PM. Reason: changed field to table -- was incorrect

  3. #3
    Amicron's Avatar
    Amicron is offline Access Guru
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Amherst, New York (near Buffalo)
    Posts
    31
    Another method... just use Month(TDATE) and that will give you the numeric month of the date field. Sort your query by this field.

  4. #4
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Thanks, that worked really well!

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

Similar Threads

  1. Search Persons (alphabetically)
    By pkstormy in forum Code Repository
    Replies: 0
    Last Post: 08-28-2010, 07:31 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