Sorting by Week and Year

S

sq75222

I have a problem on the soting by week, when i convert date to week ( "ww
YY") and sort as ascending the results is not i want see as below.

Week : 1 08,10 08,11 08,...,2 08,20 08,21 08,.... ( after sorting)

but I need to show as

Week : 1 08,2 08,3 08,4 08,..,10 08,11 08,12 08,...,20 08,21 08,....52 08.
 
J

John Spencer

Try changing your expression to
Format(DatePart("ww",YourDateField)"00 ") & Format(YourDateField,"yy")

--
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Joined
Dec 17, 2007
Messages
57
Reaction score
0
sq75222 said:
I have a problem on the soting by week, when i convert date to week ( "ww
YY") and sort as ascending the results is not i want see as below.

Week : 1 08,10 08,11 08,...,2 08,20 08,21 08,.... ( after sorting)

but I need to show as

Week : 1 08,2 08,3 08,4 08,..,10 08,11 08,12 08,...,20 08,21 08,....52 08.

It appears you are getting a character sort, you need a numeric sort.
 
S

sq75222

thk, it work. but the exp should be Format(DatePart("ww",YourDateField),"00
") & Format(YourDateField,"yy")
 

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