Full Version: Set Data Type For Expression
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
EssKayKay
Hello,

I want to sort a text field as if it was formatted as number. Is it possible to set the Data Type of an expression in a query? What I mean here is I have a field (Notice_ID) formatted as text that I want to remove the first two characters leaving the remaining number values only. Then I could sort based on numbers.

As an example, in my query I created an expression Notice_NO: mid([Notice_ID],3)

Notice_ID Notice_NO
R-1 1
R-22 22
R-117 117
R-244 224

Any suggestions would be appreciated.

Thanks,
SKK
RAZMaddaz
Try the following: Notice_NO: Cint(mid([Notice_ID],3))

This converts the text to an integer.
EssKayKay
Excellent - that did it.

Thank you,
Steve K.
RAZMaddaz
thumbup.gif

Awesome, glad I could help!!!

RAZMaddaz
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.