On Sat, 26 Feb 2005 14:57:02 -0800, "William Gee" <William
(E-Mail Removed)> wrote:
>I'm working in a library and we're creating a database of collection items,
>but I can't seem to get Access to sort them by Library of Congress call
>number correctly. Access sorts, for instance, S1.U556, S115.E32, S16.I6732 in
>that order, rather than S1.U556, S16.I6732, S115.E32. Any ideas on how to
>change the sort setting? Any idea how to create a new type of Access field
>for this data that would sort correctly?
As Marshall says, tables HAVE NO ORDER - they're unordered "heaps" of
data. You need to use a Query to sort records.
Access is sorting these values as single text strings; S1.U556 sorts
before S115.E32 because the character . is before the character 1 in
the collating sequence for strings. Access has NO way to know that you
*intend* the 1 and the 115 to be numeric values. I'm not sure what the
range of variation of these codes might be. If a valid call number
ALWAYS consists of two portions, each consisting of a single
alphabetic character followed by a number, you might want to consider
storing the call number in *four* fields rather than one: TextMajor
(Text 1), NumMajor (Integer), TextMinor (Text 1), and NumMinor
(Integer). S1.U556 would be stored as S, 1, U, and 556 respectively;
you can write an expression to concatenate the four fields for display
purposes. And they'll sort correctly.
To sort these values with the existing structure you'll need to use
some complex Mid() and InStr() expressions to parse out the letters
and numbers, and the sort will likely be VERY inefficient.
John W. Vinson[MVP]