cast order by

J

Jeff

I'm migrating some code from MySQL to ACCess

I have a character field that I wish to sort numerically (rather than
alpha numerically), I don't want to change the field type.

In MySQL I do this:

ORDER BY CAST(my_field AS SIGNED)

How is this done in Access?

Jeff
 
K

kingston via AccessMonster.com

Use Val(my_field) to return the numeric value portion of the field.
 
K

Klatuu

Create a calculated field that recasts the data type in your query and sort
on that.

SortByNum: Clng(Nz([MyTextField],0))

Will change the data type from text to long
 
Top