Results 1 to 7 of 7
  1. #1
    rooster is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    8

    Get records after specific date and time

    I have a table with a date/time field that includes both date and time data, e.g. 11/09/2013 1:34:34 PM. I need to get records after a specific time and date.



    I've tried this but doesn't seem to work:

    Code:
    SELECT * FROM Log 
    WHERE EventDate > '11/09/2013 1:00:00 PM'
    Any suggestions?

    Thanks

  2. #2
    mrojas is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Location
    Concord California
    Posts
    72
    You'll probably need to enclose the date in #
    WHERE EventDate > #11/09/2013 1:00:00 PM#

  3. #3
    rooster is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    8
    Thanks mrojas

    i'm getting records with dates including:
    9/11/12
    9/1/13
    9/9/13

    Possibly part of the problem is mixing american dates (d/m/y vs. m/d/y), but this doesn't explain the 2012 date?

  4. #4
    mrojas is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Sep 2013
    Location
    Concord California
    Posts
    72
    Could you share the table, or tables in question?

  5. #5
    rooster is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    8
    See screen shots below of sql and records.
    Click image for larger version. 

Name:	sql.PNG 
Views:	4 
Size:	3.5 KB 
ID:	13769Click image for larger version. 

Name:	records.PNG 
Views:	4 
Size:	18.7 KB 
ID:	13770

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,965
    If it really is a date/time type field, use # delimiter instead of apostrophe. If it's really a text field type then you have a problem and the filter/sort won't work the way you want. It will be an alpha sort/filter: "10" sorts before "9"

    The left justification of the data makes me think it's really a text field.
    Last edited by June7; 09-16-2013 at 12:49 AM.
    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.

  7. #7
    rooster is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    8
    Good pick June7, it was a text field.
    I didn't create this DB, using an existing one. Never thought it would be text!

    Changed the field to date, works fine now.

    thanks

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

Similar Threads

  1. Replies: 4
    Last Post: 05-26-2013, 08:53 PM
  2. Selecting from specific Date and Time range
    By LindaRuble in forum Programming
    Replies: 1
    Last Post: 05-15-2013, 07:37 AM
  3. Replies: 4
    Last Post: 03-06-2013, 02:32 PM
  4. Log time and date users update records
    By Richie27 in forum Programming
    Replies: 6
    Last Post: 06-13-2012, 09:28 AM
  5. Replies: 6
    Last Post: 01-04-2011, 05:43 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