View Full Version : Order by month - but not what you think!


deejay_totoro
05-24-2004, 02:49 AM
Hello all,

I am working on a query where there is one field that contains month information.

The data has been stored in this fashion:
01/01/2000

etc...

How might I sort this information in a normal monthly calendar style so that I might use the information properly (and supply the months information correctly for any subsequent reports.)

Thank you very much.

dj_T

Len Boorman
05-24-2004, 03:11 AM
There is a function called DatePart that will allow you to extract the Month from the date. You could then order by month.

DatePart can extract Day, Month or Year. You should find all the syntax info in the help file but if you have a prob then get back to me

len B

deejay_totoro
05-24-2004, 03:14 AM
Thanks for the reply.

Actually - I have tried the following:

nuDate: Format([Month]," yyyy mm")

which allows me to order the data.

Is the correct way to use the Format() function?

Thanks!

dj_T

deejay_totoro
05-24-2004, 03:16 AM
Thanks for the reply.

Actually - I have tried the following:

Date: Format([Month]," yyyy mm")

which allows me to order the data.

Is the correct way to use the Format() function?

Thanks!

dj_T

Len Boorman
05-24-2004, 03:18 AM
Cannot think of why not.

More than one way to do something normally

L

deejay_totoro
05-24-2004, 03:23 AM
Thanks again.

I will also look at your example later.

Cheers!

dj_T

Pat Hartman
05-24-2004, 11:41 AM
You don't want to format the date in the query. Choose the date format that you want in the control's properties. That way the data will be sorted numerically on month rather than alphabetically.