sorting numerical values

P

PowellGirlTN

I have a field in my table called Group and the groups are numeric values. I
want the data on my report to display in assending numeric order but it comes
out like this 1, 10, 11, 12, 2, 23, 3, 4, 5, 6

how can I make it sort like

1, 2 , 3, 4, 5, 6, 10, 11, 12, 23

I really don't want to have to add a zero to make all groups to characters.
 
N

norm

Is the table design set to Number or text? - it should be set as number.


<<I have a field in my table called Group and the groups are numeric values.
I
want the data on my report to display in assending numeric order but it
comes
out like this 1, 10, 11, 12, 2, 23, 3, 4, 5, 6

how can I make it sort like

1, 2 , 3, 4, 5, 6, 10, 11, 12, 23

I really don't want to have to add a zero to make all groups to characters.
 
E

Evi

It is sorting as a text field, not as a number field.

Have a look, in Design View, at your table and check if it says Number next
to this field in the DataType column.

Don't panic if it is a text field, you may not be able to simply change it
for a number field, it may threaten you with dataloss, but there are ways of
doing it and we can help you there.

If however, you have intentially set the field as a text field, then, in the
query on which your report is based, add a field which says

MyGrp:Val([Group]) - that will turn your text back into a number.

You can Sort on this field.

If your Group field has been created using a Format formula eg
Format(MyField,"0") then it will be a text field. These fields are for decor
only.

BTW you may need to ditch the field name Group. It is used by VBA and stuff
which has a second purpose in Access may suddenly and inexplicably, cause
you strange problems (data type mismatch when there is no datatype mismatch,
reports which crash on opening or work fine until you copy and paste them
and other things too horrible to mention in polite company).
Switch on the Name Autocorrect Options (which for some inexplicable reason
are switched off by default in Acc2000) and be prepared to spend some very
tedious time going through all your queries and codes.
Evi

Evi
 

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