Results 1 to 9 of 9
  1. #1
    SLT2195 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2022
    Posts
    3

    Data output sequence when running a query

    Why would 010322-01 output before 092521-01 in a query when the field is sorted ascending?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    Because 01 comes before 09. Why would you expect otherwise?
    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.

  3. #3
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,903
    Go on, I'll bite.
    Why would you think otherwise?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,776
    The values are obviously text, so once that question is figured out, it might come as a surprise to OP that
    111
    comes before
    22
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    SLT2195 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2022
    Posts
    3
    It is a "short text" field currently, but would it be possible to alter a parameter to cause it to act as if this were a number with 010322-01 being larger than 092521-01?

  6. #6
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,776
    act as if this were a number with 010322-01 being larger than 092521-01?
    you still think that 10322 is larger than 92521? Why? Ten thousand + some hundreds will never be larger than 92 thousand + some hundreds??
    IMO, your only probable solution to get what you want is to either
    - add a sort field & assign real numbers to these values in the order you want. I'd increment by 5's or 10's not 1's OR
    - split the parts into real numbers and concatenate the parts in your forms/reports/queries
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    would it be possible to alter a parameter to cause it to act as if this were a number with 010322-01 being larger than 092521-01?
    No.

    Depending on your application, you might consider a "Sequence" field to allow sorting.

  8. #8
    SLT2195 is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2022
    Posts
    3
    Found a workaround. Will sort on a "date" field before sorting on the "work-order number" field in the queries. This seems to provide the required results. Thanks to everyone. Yes, I have a lot to learn.

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Always better for communication and more focused responses when the issue is presented in context. Happy to hear there was a "date" field available for sorting.

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

Similar Threads

  1. Replies: 5
    Last Post: 02-19-2017, 03:19 PM
  2. Replies: 2
    Last Post: 02-19-2017, 03:14 PM
  3. Form data out of sequence
    By khughes46 in forum Forms
    Replies: 4
    Last Post: 08-11-2015, 10:38 AM
  4. Replies: 2
    Last Post: 03-18-2013, 03:03 PM
  5. Replies: 1
    Last Post: 05-15-2012, 11:40 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