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

Sorting on ASCII values? 1

Status
Not open for further replies.

fxplorr

Programmer
Sep 29, 2004
13
US
I'm a novice Accesser so bare with me.

It was brought to my attention (where I work) that a certain report, which is based off a query did not have the stock numbers sorted correctly.

Our Stock Number field is formatted as Text and sorted in ascending order in the query. The problem is caused when we have hyphens "-" in the stock number. It is not recognized. Here is an example:
1234
1235
1235-ASST
1235-B
1235-BK
1235KB
1235KG
1235-O
1235-PL
The Stock Numbers 1235KB & 1235KG should fall after the s/n's with the hyphen. I was shown that in ASCII, the hyphen comes before alphabetic characters. How can I do this in my query? Any help would be greatly appreciated!
Thanks in advance!!!
 
Try an Order by clause like this
Code:
ORDER BY Replace(StockCode,"-","")
 
Hi,

Amazing!

Here's a klunky workaround.

1) Replace "-" with " " [Space]

2) Sort

3) Replace " " with "-"

Skip,

[glasses] [red]Be advised:[/red] Researchers have found another Descartes trueism, "Cogito ergo spud."
"I think; therefore, I YAM!
[tongue]
 
Golom,

GOOD ONE! ==> *

Skip,

[glasses] [red]Be advised:[/red] Researchers have found another Descartes trueism, "Cogito ergo spud."
"I think; therefore, I YAM!
[tongue]
 
Thanks, you ROCK! The "" didn't work, but the " " did!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top