Results 1 to 2 of 2
  1. #1
    carmenv323 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Oct 2021
    Location
    Massachusetts
    Posts
    60

    Order by - multiple sort


    I have a union query that I want to sort using the following:

    IIf([cboEstimateStatus]="Incomplete",1,IIf([cboEstimateStatus]="Returned",2,IIf([cboEstimateStatus]="Pending Request",3,4))) AS Status

    ORDER BY IIf([cboEstimateStatus]="Incomplete",1,IIf([cboEstimateStatus]="Returned",2,IIf([cboEstimateStatus]="Pending Request",3,4)))

    These are the main statuses and I want these to be on top but I also want to add another field which would be project number. How can I modify this to add [txtProjectNumber] to the sort?

    The output would look like:


    Attached Thumbnails Attached Thumbnails Screenshot 2022-01-18 112307.jpg  

  2. #2
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,068
    Try
    ORDER BY [Project Number],IIf([cboEstimateStatus]="Incomplete",1,IIf([cboEstimateStatus]="Returned",2,IIf([cboEstimateStatus]="Pending Request",3,4)))

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

Similar Threads

  1. ORDER BY sort order?
    By TOPSie in forum Queries
    Replies: 4
    Last Post: 04-23-2021, 03:25 AM
  2. Replies: 5
    Last Post: 08-27-2019, 08:41 AM
  3. Sort Order problem
    By Chris@harveynorman in forum Reports
    Replies: 8
    Last Post: 11-22-2016, 10:42 PM
  4. Sort by Month Order
    By sk88 in forum Reports
    Replies: 1
    Last Post: 03-17-2015, 05:22 PM
  5. Replies: 1
    Last Post: 09-16-2014, 12:52 PM

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