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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting Numbers in a text field without changing field type

Status
Not open for further replies.

ychousa

MIS
Jun 11, 2003
82
US
I was wondering if there's any way to sort numbers in order in a text table without changing field's data type to Number. I need to have numbers(1st, 2nd,...,50th) and some text options(eg.Returned) together in a field, but I can't sort the numbers in order. Thanks for your reply in advance.
 
I made number part to 1,2,...50 to make things easier. Thanks.
 
If the complete set is properly 'formatted',


Code:
? Val("50th")
 50 
? Val("1st")
 1

however the premise is -at best- a hope





MichaelRed


 
could you store the field as a number and add the st th and nd on the form / report?
 
In the query you use to access the data, create another field which is a numeric copy of the field you are interested in. Sort on this field in your application. You don't need to display it.

 

If you sort on CInt(Left([YourField],Len([Your])-2)) you can keep the 1st,2nd,3rd etc format. Just hide the above field if you dont want to display it.

Mordja
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top