Re: Sort by Month

From: Douglas J. Steele (NOSPAM_djsteele_at_NOSPAM_canada.com)
Date: 08/20/04


Date: Fri, 20 Aug 2004 09:10:53 -0400

Add a computed field to your query, and sort by it. If all you want is by
month (so that January 2001 and January 2004 would get sorted together), use
Month([MyDateField]) as the computed field. If you want to sort by year and
month, use Format([MyDateField], "yyyymm"), or add two computed field
Year([MyDateField]) and Month([MyDateField]), and sort on both.

Replace MyDateField with the appropriate field name.

-- 
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"Andrew Wilkins" <AndrewWilkins@discussions.microsoft.com> wrote in message
news:490CEE33-B222-4E98-95F1-77CFE23C729F@microsoft.com...
> I have a few thousand records that all contain a date field in the British
> format of dd/mm/yy. I want to create query that groups the records into
> months. So, all records that have 01 as the month go in the January
column,
> and so on. How do I do this?
>
> Thanks!


Relevant Pages

  • Re: Sort file by computed field
    ... You say that you are to sort on a computed field that is not in the ... would appear as the first record of the output file along with all the ... something like all between one value and the next group minus one. ...
    (comp.lang.cobol)
  • Re: Sorting
    ... add a computed field to your query along the lines of ... Put SortField ahead of PartNumber in the sort order. ... If I sort my query by ... If I sort my query by part number (desending) I get all records with part ...
    (microsoft.public.access.queries)
  • Re: Sort file by computed field
    ... >How do I sort records in a file based on a computed field based on two ... You use the SORT verb. ... The OUTPUT PROCEDURE prints the report. ...
    (comp.lang.cobol)
  • Re: Sort Ascending
    ... Easiest solution would be to add a computed field to the query, and sort on ... there are some entries that do not have any dates. ... ascending sort. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Sorting Months
    ... Add a computed field that returns the month number (either the Month ... function, or format as mm, not m). ... Sort on that field, even if you don't ... > instead of by calendar order. ...
    (microsoft.public.access.reports)