Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

customizing the sorting of a query

Status
Not open for further replies.

davikokar

Technical User
May 13, 2004
523
IT
Hallo,
is there a way to customize the sorting order of a query if ascending or descending (numerical or alphabetical) are not the ones I would like? The situation: a field of the query will return country names (4 countries are included). I would like to sort the data by the country names but not in alphabetical or reverse alphabetical order... any ideas. Thanks
 
My attempt

Create a table with your 4 countries and have a field numbered 1,2,3,4 in the order you want them sorted. Join that table to your query and sort on the number.
 
In your query add a calculated column containing your sort key:
SortKey: IIf([country name]="country A",1,IIf([country name]="country B",2,IIf([country name]="country C",3,4)))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
mmm... could be a solution, but I was wondering if there is a way to do it through sql code...
 
To do it through sql code
What are the order choice criterias ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I'll try your suggestion PHV, thanks. My last message was an answer to suicidED...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top