Extracting Month and year

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
 
D

Douglas J. Steele

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top