Results 1 to 4 of 4
  1. #1
    squirrly is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2011
    Posts
    33

    Sort by range of rows?

    Not sure if this is the right forum to be asking this, but can a range of rows be sorted in Access? I may have a design problem as well...

    I have one table listing all breeds by type. My queries work fine pulling all breeds into a dropdown list according to type.

    BREEDS
    BreedID (FK)
    Breedname
    TypeID (FK) (cats, dogs, birds)


    At the beginning of each new list, I have "other" and "unspecified". For example:

    Breedname TypeID
    Other 1
    Unspecified 1
    Abbysinian 1
    Bengal 1


    Cornish Rex 1
    Other 2
    Unspecified 2
    Airedale 2
    Beagle 2
    Collie 2
    Other 3
    Unspecified 3
    Amazon 3
    Canary 3
    Dove 3

    The breednames were initially entered alphabetically, but I will sometimes need to ADD a breed as well at the bottom of the list. How can each range of breednames by type be sorted alphabetically while keeping "Other" and "Unspecified" at the top of each list? I can throw an underscore at the beginning of each, but that doesn't look good as output. I'm thinking this is more of a SQL issue, but thought I'd try here first.

    As I ask this, I realize that multiple "Other" and "Unspecified" is probably bad...

    Thanks for your help!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Quote Originally Posted by squirrly View Post
    As I ask this, I realize that multiple "Other" and "Unspecified" is probably bad...
    That was my first thought, but you could achieve the result with another field, like "SortOrder". Make it the primary sort field, and put 0 in for "Other" and "Unspecified" and 1 for everything else.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    squirrly is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Aug 2011
    Posts
    33
    Well, now, THAT is an interesting thought and very, very simple!!!

    Just tried it and it works like a charm as long as I give the SQL the first/second fields to sort. Awesome, THANK YOU!
    Working completely alone can run a person insane, so I'm thankful for this forum! Should've asked weeks ago....

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem, and glad you found us!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 08-08-2012, 02:02 PM
  2. Replies: 0
    Last Post: 02-09-2012, 05:43 PM
  3. Replies: 2
    Last Post: 08-28-2011, 06:06 AM
  4. Replies: 7
    Last Post: 12-11-2009, 01:44 AM
  5. How to sort by three sort orders
    By captgnvr in forum Access
    Replies: 4
    Last Post: 11-09-2009, 07:30 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums