Results 1 to 3 of 3
  1. #1
    cowboy is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2010
    Posts
    291

    Query sorting numbers not working, sort is ignoring negative signs

    I have a query with has a computed field which if there is not a date that the project is completed it takes the logged date - the due date to return how many dates left or past due. The query is:


    DaysLeft: IIf(IsNull([Completed]),[Due]-Date(),"")
    When I run the query I get something like this:
    Click image for larger version. 

Name:	Original-sort.png 
Views:	11 
Size:	6.1 KB 
ID:	36981
    Then I use the sort A to Z as shown here:
    Click image for larger version. 

Name:	Query-Sort1.png 
Views:	11 
Size:	12.8 KB 
ID:	36982
    and the following are the results:
    Click image for larger version. 

Name:	Query-Sorted.png 
Views:	11 
Size:	6.6 KB 
ID:	36983
    Any ideas on how to get the numbers to sort from the largest negative number to the largest positive number?

    Also is there a way to sort from the largest negative number to the largest positive number and have the blanks at the end?

    Thank you for any input you might have.

    -Dan

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    ??? If Completed is not Null --that is, has a value -Do you want to report completed?

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    You are using empty string for the alternate value. Forces all values to be treated as text, not numbers and apparently the negative sign is a secondary order so they follow the positives for the same 'number'. Use Null instead.

    Null and empty string will always sort first Ascending and last Descending.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 2
    Last Post: 08-30-2017, 07:11 AM
  2. Ignoring articles when sorting
    By SethLibrary in forum Access
    Replies: 4
    Last Post: 10-26-2015, 06:07 PM
  3. Numbers turning to number signs
    By bradp1979 in forum Reports
    Replies: 5
    Last Post: 09-17-2015, 03:10 PM
  4. Replies: 4
    Last Post: 05-07-2015, 03:49 PM
  5. Replies: 1
    Last Post: 10-22-2014, 01:28 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