Sorting queries

  • Thread starter Thread starter Lee
  • Start date Start date
L

Lee

I'm not sure if this can be done, but is there a way to do
a custom sort on a query? I have several items grouped
into categories, and I am using these numbers to populate
a spreadsheet. The problem is that the way it is listed
on the spreadsheet is not the same order that Access sorts
it in, so when I transfer the numbers I have to rearrange
them. It's not a huge issue, but it's irritating and
slows me down, and I have a lot of spreadsheets to
populate.

Currently, Access sorts in alphabetical order, ascending.
I need the item that is listed 2nd to be first, 3rd to
2nd, etc. Is there a way to do this in design mode?

Thanks, Lee
 
How you do it will depend on the data. Usually, this will be done by
creating a calculated field in the query for sorting purposes only (uncheck
the display box). This frequently happens when you are trying to sort
numbers in a text field. To get them to sort in numeric order you would need
to change them back to numbers, so the field would look something like

SortMe:CInt([Field1])

This would convert Field1 from text to numeric then do the sort. You can
also use the Left or Right function here to sort on only part of the field.

This could also be done by creating an extra field in the table and using it
instead of the calculated field. Just number the field in the table in the
order you want the records.
 
Back
Top