Sorting numbers

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

Rick Brandt

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()?
 
W

whp

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.
 

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