Sorting numbers

  • Thread starter Thread starter catherine
  • Start date Start date
C

catherine

Does anyone know of a way to sort numbers so that access
doesn't display 1, 10, 11, 12, and then 2? I've been
using 01, 02, etc but was hoping for a way to eliminate
the 0 and still have it sorted properly. Thanks in
advance.
 
catherine said:
Does anyone know of a way to sort numbers so that access
doesn't display 1, 10, 11, 12, and then 2? I've been
using 01, 02, etc but was hoping for a way to eliminate
the 0 and still have it sorted properly. Thanks in
advance.

They are sorting that way because they are not numbers but rather strings that just
happen to contain numerical characters. Did you use a number field for the data?

Either...

Val([YourField])
or
CInt([YourField])

....would convert them to numbers on-the-fly and would then allow for a proper
numerical sort, but if the field were numerical to begin with that would be
unnecessary. Perhaps you are already using an expression that is converting them to
strings; Format() or Nz()?
 
catherine said:
Does anyone know of a way to sort numbers so that access
doesn't display 1, 10, 11, 12, and then 2? I've been
using 01, 02, etc but was hoping for a way to eliminate
the 0 and still have it sorted properly. Thanks in
advance.
 
Back
Top