Multiple sorts on query?

margt_a

Registered User.
Local time
Today, 02:26
Joined
Aug 15, 2002
Messages
35
Hello, all.

I have a combo box that sorts a form based on an accession number. The accession number is alpha-numeric (like this: 4KF093). My question is this: How can I have the combo sort the accession numbers by (1) the first digit, descending, then (2) the last three digits, ascending. I have used Mid and Left functions to return the digits separately, but I can't make the query sort both independently. It will only sort one or the other. How do I sort the query twice in sequence?

The query stands as follows:

SELECT tblProposalNos.PropID, tblProposalNos.PropNum, tblProposalNos.PropName, Left([PropNum],1) AS Expr2, Mid([PropNum],4,6) AS Expr1
FROM tblProposalNos
ORDER BY Left([PropNum],1) DESC , Mid([PropNum],4,6);

Any help greatly appreciated as always.

Mallen
 
Worked like a dream. Thanks, Tony.


Tony Hine said:
Can't see why it won't work, but try this anyway...

SELECT tblProposalNos.PropID, tblProposalNos.PropNum, tblProposalNos.PropName, Left([PropNum],1) AS Expr2, Right([PropNum],3) AS Expr1
FROM tblProposalNos
ORDER BY Left([PropNum],1) DESC , Right([PropNum],3);
 

Users who are viewing this thread

Back
Top Bottom