Sort Error

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I've created a query that chages date into weeks using the format([],"ww") function. Then I count these values. However, when I sort them the order no longer follows.

A typical sort results in : 1,2,3,4,5,6,7,8,9,10,11..
But I'm getting: 1,11,12,13,14,15,16,17,18,19,2,20...

How can I solve this issue

Daniel
 
If you put the function VAL() around your expression, you
will be able to sort them correctly.
-----Original Message-----
Hello,

I've created a query that chages date into weeks using
the format([],"ww") function. Then I count these values.
However, when I sort them the order no longer follows.
 
I've created a query that chages date into weeks using the format([],"ww") function. Then I count these values. However, when I sort them the order no longer follows.

A typical sort results in : 1,2,3,4,5,6,7,8,9,10,11...
But I'm getting: 1,11,12,13,14,15,16,17,18,19,2,20....

How can I solve this issue?

The Format() function returns a Text String - which will indeed sort
the way you describe.

Instead use the function DatePart("ww", [fieldname]) - this will
return a numeric week number, which will sort correctly.
 
Back
Top