one more question MR.liviutudor or any Available expert on the qsl statement

i am doing "...order by cStr(partname)"
it works fine as string sorting can you please tell me what to do if i need to sort useing the ACS() or cLng what to do cause its not working
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

well, if partname is already a string/text datatype then you don't need the CStr(partname) -- you could simple say ...order by partname
similar, if the column you want to order by is a number, you don't need to use CLng() -- simply just order by <column name>
Last but not least: I gather you are using ACCESS?
najixpAuthor Commented:
you i am useing msacces but visual basic inteface
the fact is the column is a string/text datatype i want to sort it useing the ascii of the string useing the sql statement
Is the part name a number by any chance?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

well, like i said, if the column is a string, you do not need the CStr() function and it will sort it in alphabetical order -- is this not what you want?
Numerical order being different from alphabetical order could be your problem.  Depending on which one you want you can use CLng or CStr in the order by section but that looks like what you've already done.
The ASC() of a character is the numerical code that represents the character.  I don't think you can ASC("WORD") and sort.

If you want a numerical sort of the query string use CLng as long as there are no non numerical characters.  If you have one partname in your list that has a non numerical character your stuck with alphabetical order and or would have to jump through major hoops to get whatever results your looking for.
Heres a crazy idea:

Bring in your Numerical first then bring in your NonNumerical and put them together with some kind of custom sorting routine.
najixpAuthor Commented:
hi i am back
all i need is to sort the string/text datatype column useing their ascii in sql statement
what exactly do you mean by "using their ASCII"???? :O
alphabetical sort is sorting them in order of their ASCII code! And the ASCII code is such that the code for 'a' is smaller than the code for 'b' which is smaller than the code for 'c' and so on...
According to Wikipedia ( ASCII is the text representation of standard printable characters.  So based on wikipedia's definition of ascii you want a text string sort or alphabetical sort.  Simply use the following:

SQLQuery = "SELECT CStr(PartNumber) as MyStringPartNumber FROM YourTable
                    ORDER BY MyStringPartNumber"
Now.. if your wanting to sort by the numerical code representation of each character in each word of every record PartNumber... thats crazy man!!  But I dig it ya know.
To do that you would have to be able to seperate each character of each word, convert it to the ASCII code representation and perform the sort for each word based on each ASCII code in that word for all records.  I'm not sure you can do that with the limitations of SQL Query Language.  I also think that if you were successfull that it would be a monster from Planet X.  I don't think I really want to spend the time to figure that one out and so I yeild to those who have alot more time on their hands.  

Also,I think it would be impossible if all PartNumbers didn't have the same number of characters, however, I'm not positive of this.
If all partnumbers had same number of characters I would seperate them all using the midstring function and then order them sequentially ie:
SELECT ASC(Mid(PartNumber,1,1)) as A, ASC(Mid(PartNumber,2,1)) as B... FROM MyTable

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Wow.. was not expecting that one to be the solution for you.  Glad you could use it.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.