+ Reply to Thread
Results 1 to 2 of 2

Date field in Access refusing to sort

  1. #1
    Forum Contributor
    Join Date
    03-05-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    301

    Date field in Access refusing to sort

    Hi all,

    I am trying to sort dates in access. I know, the question is posted everywhere (I know because I've looked for the answer), except that not a single answer has proven right.

    In a continuous form, I am trying to sort a date field (Date/Time (Short Date)). The following code is On Click event.

    Please Login or Register  to view this content.
    This works to keep the dates at the top and the blanks to the bottom, however, the dates are displayed like so

    Please Login or Register  to view this content.
    This is completely bizzare and I don't understand why it's not working.

    It is supposed to look like:

    Please Login or Register  to view this content.
    Can anybody please advise why this is not working and how to make it do what I need it to do.

    Cheers

  2. #2
    Forum Contributor
    Join Date
    03-05-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    301

    Re: Date field in Access refusing to sort

    I think I have an answer to my own question.

    Some people had provided this similar idea in various responses around the web. So many answers just didn't work, but when I came to understand what the issue was, I did this:

    Please Login or Register  to view this content.
    That old NULL sure does throw things around a bit. Instead of Null (e.g. Nz(...etc...)) I used the field length (0), and set the falsepart to 99999, which puts the date about 50 years into the future.

    This then sorts the blanks (i.e. 99999 dates) to the bottom, and the dates in the required order at the top. the future dates are of course, hidden.

    If you use this in a query instead, simple add the IFF function above to a new calculated field, and sort on it (not the named field). You should also not display it.

    Hope this helps someone in future.

    Cheers

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] in vba for access how do i get the day of the week for a date field?
    By Daniel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  2. [SOLVED] in vba for access how do i get the day of the week for a date field?
    By Dave Peterson in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-06-2005, 07:05 AM
  3. [SOLVED] in vba for access how do i get the day of the week for a date field?
    By Dave Peterson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-06-2005, 06:05 AM
  4. [SOLVED] in vba for access how do i get the day of the week for a date field?
    By Daniel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  5. in vba for access how do i get the day of the week for a date field?
    By Daniel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  6. in vba for access how do i get the day of the week for a date field?
    By Daniel in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  7. Replies: 1
    Last Post: 07-07-2005, 08:05 PM
  8. in vba for access how do i get the day of the week for a date field?
    By Daniel in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-07-2005, 08:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1