Extracting Month and year

  • Thread starter Thread starter Simon
  • Start date Start date
S

Simon

I have a query that lists all products i have sold what i would like
to do is do a count of each product for the number sold each month

I know how to extract the month for the date by using Month:
Month([OrderDate])

But as i want to go back a few years i need to extract month and year
so it display Jan 08 or Dec 07


I would like to create Jan 08 in one field in the query and not split
it into two

Any help would be great

SImon
 
To display only month and year, use Format([OrderDate], "mmm yy"). Of
course, that won't sort very nicely (Apr will be before Aug which will be
before Dec and so on). If you want to be able to sort, add an additional
field Format([OrderDate], "yyyymm"), and sort on that field (whether or not
you display it).
 
Back
Top