Sort order problem

kbrooks

Still learning
Local time
Today, 02:44
Joined
May 15, 2001
Messages
202
I'm positive this has been addressed before but have been unable to find threads....I think I'm not using the correct search words. :confused:

I have a database that we track IP addresses in. On a report, the sort order is kind of off:

10.1.100.1
10.1.100.10
10.1.100.11
10.1.100.2
10.1.100.20



Is there any way I can get this to sort:
10.1.100.1
10.1.100.2
10.1.100.10
10.1.100.11
10.1.100.20


I understand how it's sorting, but I'm unsure how to change it.
TIA!
 
The only reasonable way to do this is to reformat the address parts into a fixed-width format with a one-part key of 000.000.000.000, or to break up the parts to a numeric format and have a four-part numeric sort key, using a display-only format to put the parts back together again.

Either case requires you to break apart the addresses into four separate octets. The InStr function can help you find the dots and the parts between them. What you do from there depends on the method you chose.

Neither one is particularly nice, though, 'cause no matter which one you choose, if you ever have to search through the silly things, you have to convert your search strings too. But there is really no other simple way to do this.
 

Users who are viewing this thread

Back
Top Bottom