473,664 Members | 2,898 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

When is "+1233" less than "-1233"

675 Contributor
I have a table with a field -- Code -- containing the following values:
+1233
1233
-1233
w-aaa
wcc
wcc'
wcc k
wcc!
wcc,
wcc'a
wcch
wccm
wcc'
w-zzz

These are shown above in Ascending order if ordered with the A|Z button on the Table Datasheet Toolbar. Also this is the order when SQL = SELECT Code FROM Test ORDER BY Code.

Immediate Window ?"+1233" < "-1233" gives me True.

As I can set a database sort order in Tools->Options, with about 30 choices, I presume that Access has tables to convert from ASCII to a sort order differing by language.

Is it possible for me to create and use such a table?

OldBirdman
Dec 1 '08 #1
4 1687
ChipR
1,287 Recognized Expert Top Contributor
Does anyone know where to find the options equivalent to the tools->options in Access 2007? I can't find it at all.
Dec 1 '08 #2
ChipR
1,287 Recognized Expert Top Contributor
The only thing I can come up with so far to compare numbers accurately when mixed with strings is to use the IsNumeric() function to sort the numbers from the text and sort them separately. That does handle the "+" correctly. Otherwise I don't see how any string value for + is going to sort +1, 1, +2, 2, +3, 3 correctly, or anything similar.
Dec 1 '08 #3
OldBirdman
675 Contributor
First, I notice a typo in the "Sorted" list originally presented. The second occurrance of wcc' should be wcc's in the second from bottom item. Sorry.

For true numeric strings, IsNumeric would allow creating a second field in the table and storing the numeric portion in that field. Then the table could be sorted by ORDER BY LeadingNumeric, Code. If my new field -- LeadingNumeric-- were filled by LeadingNumeric = Val(Code), and non-numeric strings had the value 9999999999 to force the alpha data to the end, Unless the numeric were imbedded in the string, i.e. X+1233X, X1233X, X-1233X, then the original problem occurs.

This doesn't address the problems with special characters, nor the fact that I may not want the Upper and Lower case alphabetic characters to be considered identical.

Original question - can I define my own sort order?
Dec 1 '08 #4
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Sorry, OldBirdman, I too am not aware of any way that a custom sort order table can be defined and applied at run-time that would change the way Access sorts alpha-numeric data. When I need to define custom ordering I create calculated fields in the underlying query that reflect the components of the sort, then combine these to create a single custom field that can be sorted using the default alphanumeric sorting.

-Stewart
Dec 2 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
9511
by: Jeremy Howard | last post by:
Hello everyone, I'm not a database guru so I'm sorry if this is a dumb question but here it goes... I have this sql query that I'm trying to run against a table on a Sql 2k server: SELECT * FROM ChangeTable
0
1012
by: John Baker | last post by:
Hi: I have a query that includes a calculation. where I am computing the number of minutes between two times as in : Minute(-) This results in the number of Minutes more than a rounded hour. I want to show this in the query result as a two digit field. This works fine when the result is greater than 10 minutes, but when its less than 10 minutes the single character appears. For example, 4:05 minus 4:00 comes up with 5. I would like...
8
16228
by: ZRexRider | last post by:
Hi, I have an application that uses MS-SQL Linked tables. I have a utility routine that drops all links and re-establishes them. It works great when my connection string is a DSN connection but I would like to change it to DSN-Less so users don't have to set up ODBC connections on each workstation. If I use the following DSN
65
2969
by: PengYu.UT | last post by:
Hi, Sometimes, I write = instead of == in if conditions by mistakes. Is there any way the gcc compiler can give me a warning? Best wishes, Peng
11
8779
by: Martin Jørgensen | last post by:
Hi, - - - - - - - - - - - - - - - #include <iostream> #include <string> #include <map> using namespace std; int main() {
8
9628
by: Greg Strong | last post by:
Hello All, The short questions are 1 Do you know how to make DSN connection close in Access to Oracle 10g Express Edition? &/or 2 Do you know how to make a DSN-less pass-through query work from
3
2281
by: ek | last post by:
I have the following class: template<typename I> class test { public: test(I i) : pp(i) {} I getpp() const { return pp; }
2
2904
by: desktop | last post by:
I get this error when I run my program: red_black_tree.cpp:188: error: no matching function for call to ‘std::less<MyObj<int::less(MyObj<int>&, MyObj<int>&)’ /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h:224: note: candidates are: std::less<MyObj<int::less() /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_function.h:224: note: std::less<MyObj<int::less(const...
1
1903
by: gnidoc | last post by:
This is a small perl script I wrote to check mirror lists (files filled with one URL per line). It prints " http://..." when an URL can't be retrieved and just prints the url when everything goes fine. The code is pretty straightforward and it works well until I am trying to redirect its output. There is one thing I can't figure out. As far as I know the program called 'less' prints its input on the screen providing a nice interface for...
5
3450
by: ukfusion | last post by:
I have an sql query which has several fields and no matter how hard i try i cant get the less than statement to work....i originally tried between but that wouldnt work either. $yourpricesearch is the name of the drop box with in the search form with the price values of 5.00, 10.00, 15.00 etc...i did it this way as i wasn't sure if when i put the AND in when the value of $yourpricesearch was empty would cause problems so im only putting the...
0
8437
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8861
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7375
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4185
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4351
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2764
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2003
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.