Results 1 to 5 of 5
  1. #1
    sfgiantsdude is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    34

    sort query results by calendar month


    I'm trying to sort my query results by the month value "Data (IMPORT).KP_MM_DS" but I get alphabetical results. Any suggestions?

    SELECT [Data (IMPORT)].KP_YR_NB, [Data (IMPORT)].KP_MM_DS, Round((Count([Data (IMPORT)].KP_ISSU_ID_NB)/20)) AS CountOfKP_ISSU_ID_NB, [Data (IMPORT)].KP_MM_DS
    FROM ([Data (IMPORT)] LEFT JOIN [Facility Lookup] ON [Data (IMPORT)].KP_FAC_NM = [Facility Lookup].[FAC NAME]) LEFT JOIN DEPTLOOKUP ON [Data (IMPORT)].KP_DEPT_ORG_NM = DEPTLOOKUP.[EPM DEPARTMENT NAME]
    WHERE ((([Facility Lookup].[REPORTING MCA])<>"XXX") AND (([Data (IMPORT)].KP_SB_RGN_CD)="N"))
    GROUP BY [Data (IMPORT)].KP_YR_NB, [Data (IMPORT)].KP_MM_DS, [Data (IMPORT)].KP_MM_DS;

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    try adding month() function to your query and sorting that field.

    Dale

  3. #3
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    What is the format of your date field? (maybe provide some examples)
    Is it actually formatted as a date field or a text field?
    Can your data span multiple years where you would need to keep "March 2012" separared from "March 2013"?

  4. #4
    sfgiantsdude is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jan 2012
    Posts
    34
    Hi JoeM

    Thanks for your reply.

    The field that needs to be sorted by calendar month is "KP_MM_DS" and the values are just month, i.e. "January", "February". It does not need to be concatenated by year or anything like that. It's being grouped by year but it doesn't need to have it combined. Thanks!

  5. #5
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You can create a calculated field that uses your month for sorting purposes, i.e.:
    Code:
    DateSort: DateValue([KP_MM_DS] & " 1, 2000")

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

Similar Threads

  1. 30 reward dollars per calendar month.
    By NewMexicoNovice in forum Access
    Replies: 2
    Last Post: 05-31-2013, 05:42 PM
  2. Sort by month
    By Symlink in forum Access
    Replies: 4
    Last Post: 03-28-2013, 03:07 PM
  3. Replies: 3
    Last Post: 01-15-2013, 01:58 PM
  4. Sort by month then day
    By mrkaye in forum Access
    Replies: 2
    Last Post: 04-23-2012, 09:46 AM
  5. Export Access reports/query results to Outlook Calendar/Task
    By kfinpgh in forum Import/Export Data
    Replies: 0
    Last Post: 02-22-2007, 01:09 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