Results 1 to 7 of 7
  1. #1
    Join Date
    May 2004
    Posts
    15

    Unanswered: Need a sort but not alpha......

    I want to sort my continuous form by a certain field but not by alphabetical order.

    I need to sort my list of records, first by "Reserved" then, "Wait List" and last "Cancelled"

    any help?

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    Not the most elegant solution, but borne of necessity: if I want to sort on a small number of values I usually use an expression:

    Sorter: IIf([field]="Reserved",1,IIf([field]="Wait list",2,IIf([field]="Cancelled",3,4)))
    Sort on the derived field to get your order. If you end up with many more values, better to create a lookup table with your order numbers in there.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Mar 2004
    Location
    Greenville, SC
    Posts
    271
    You could add a column with an alpha letter! Then sort by the new column!!

    A "Reserved"
    B "Wait List"
    C "Cancelled"
    Gotta to do some code

  4. #4
    Join Date
    May 2004
    Posts
    4

    SWITCH function

    In the query your using - in a blank field type:

    Expr1: SWITCH ( [yrfieldname] = "Reserved",1,[yrfieldname] = "wait list", 2, [yrfieldname] = "cancelled", 3)

    SORT by ASCENDING

    hope that helps!

  5. #5
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Nice function Steve. Not seen that before - no nasty nesting.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  6. #6
    Join Date
    May 2004
    Posts
    15
    can you explain the switch() func?

    thanks, it works great and very simple to add

  7. #7
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    SELECT stuff.*
    FROM stuff
    WHERE stuff
    ORDER BY stuff.field1, stuff.field2, stuff.field3
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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