Results 1 to 3 of 3
  1. #1
    pclorikeet is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    2

    Problem with sorting by Date only in DateTime field

    Hi! I have this very basic query:

    Click image for larger version. 

Name:	image1.PNG 
Views:	8 
Size:	5.0 KB 
ID:	21339

    where I am trying to sort records by descending Date. The field is defined as DateTime.
    If it sorted correctly by DateTime then the results of the ID field which is an AutoID should be sorted from highest ID to lowest ID value, however this is not the case. It seems that Access is sorting by Date (and ignoring the Time component of the date). My datetime field only stores the date and not time, but I would have thought that in the background, Access would be storing a DateTime value, so that when I sort by Date Descending, it would actually sort by DateTime descending.

    If it sorted by Date and Time then the ID field, by nature of it being an auto increment field, should have the highest ID at the top, to lowest ID.

    Click image for larger version. 

Name:	image2.PNG 
Views:	8 
Size:	20.7 KB 
ID:	21340 Click image for larger version. 

Name:	image3.PNG 
Views:	8 
Size:	9.1 KB 
ID:	21341


    Has anyone else experienced this?

    Help !?!?!?

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2013
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    If you are entering data in the date/time field and only entering the date and not the time, Access will assume that all time is midnight or 0:00:00 and will not distinguish between other date entries having the same date.

  3. #3
    pclorikeet is offline Novice
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2015
    Posts
    2
    Thanks!

    You learn something new every day!!
    I would have thought that Microsoft would have used date and time in the background ... but I can also understand why not !

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

Similar Threads

  1. Replies: 1
    Last Post: 08-02-2014, 02:41 PM
  2. Get only date from a datetime in access
    By scorpion99 in forum Queries
    Replies: 4
    Last Post: 11-30-2013, 09:43 AM
  3. Replies: 0
    Last Post: 10-11-2013, 06:07 AM
  4. Sorting by Date in non-Date Field
    By Chris1112 in forum Forms
    Replies: 11
    Last Post: 05-09-2012, 12:40 PM
  5. Problem sorting date on query
    By system243trd in forum Queries
    Replies: 4
    Last Post: 12-02-2011, 01:05 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