Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Apr 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    sort in access (Access 2000)

    I have a table in access with a colom with 5 values. Let's call them P,S,C,A,F

    I want to order the table by this colom in the following way: A,F,S,C,P. This is not alphabetical. I don't know how to do this, does anyone else have a clue??

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: sort in access (Access 2000)

    Make a query with your table and add a column with following expression :
    SortOrder: InStr("AFSCP",[Myfield])
    where Myfield the field is containing the letters.
    Now Sort ascending on the column containing the expression
    Francois

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: sort in access (Access 2000)

    Another way is to create a query, adding a column for each value. The first column would look like this:

    FieldName: myfield="A"
    Sort: Ascending
    Show: (blank)

    You actually only need 3 columns like this, for the "A", "F", "S". The 4th column would be a "catch all", the would just have [myfield] sorted Ascending (and still not shown).

    This technique is especially useful when your field values are of various lengths. For example, if you wanted to sort by City and you wanted: "New York" to be first, then "London", then "Rome", then "Madrid", then everything else.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  4. #4
    New Lounger
    Join Date
    Apr 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: sort in access (Access 2000)

    Thanks for the answers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •