Two columns in a Query (1 Viewer)

marksa

Registered User.
Local time
Today, 19:00
Joined
Apr 2, 2002
Messages
13
I have a query that lists names, functions, primary/Alternate/Reference, and contact information.

I have successfully built queries from the main query to break out the specific "functions". I would like to further sort those queries by "P" then "A" then "R". Obviously sorting by ascending or decending doesn't work becauses of the third choice.

Any thoughts.

thanks,
 

Bushido121

Registered User.
Local time
Today, 19:00
Joined
Nov 13, 2001
Messages
15
Add this calculated field to your query and set sort to Ascending for this new field.

SortOrder: IIf([TableName]![Primary/Alternate/Reference]="P",1,IIf([TableName]![Primary/Alternate/Reference]="A",2,3))


Complete SQL Below:
My Tables name is SortOrder

SELECT SortOrder.Name, SortOrder.Functions, SortOrder.[Primary/Alternate/Reference], SortOrder.Contact, IIf([SortOrder]![Primary/Alternate/Reference]="P",1,IIf([SortOrder]![Primary/Alternate/Reference]="A",2,3)) AS SortOrder
FROM SortOrder
ORDER BY IIf([SortOrder]![Primary/Alternate/Reference]="P",1,IIf([SortOrder]![Primary/Alternate/Reference]="A",2,3));
 

Users who are viewing this thread

Top Bottom