Hi!
No. Just use 2 different queries. You can also build a function that will reverse in sorting order the resulting value of the SortOrder expression, but this is not an easy task for character expression. For numeric it is just '-Expression'. For strings you require to change each character code in string to its opposite (chr(255-asc(CharCode), or use 128-based). Zip4is probably a number, but what is DP? If it is a number also, your sorting expression will look like following:
Select *, iif(LotOrder="D",-1,1)*val(PADR(IIF(Left(CRRT,1) = "B", Zip4 , DP), 4)) AS Sortorder ;
From MasterList ;
Where Zip = "96700"
Order By MailStream, Zip, CRRT, SortOrder ;
Into Table ClientFile
In other case you will require to use the CHRTRAN() to reverse each character of the character value.
>Thanks it worked great, which lead me to another question regarding the ASC DESC values. I need to also sort ascending if the value in my LotOrder field is "A" and descending if the value in my LotOrder field is "D". Is the fix for this as simple as the last one?
>
>Thanks again for your help.
>
>Aloha,
>
>James
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.