Results 1 to 7 of 7
  1. #1
    sking89 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    6

    How to filter for...

    I have a database that produces a report for everything that has been entered since the day before at 5:00:00 AM. I have tried everything but it seems like I can only do either or for the filter... either the yesterday Date ()-1 or the time >=#5:00:00 AM#. I cant seem to combine them...



    Can anyone help or does anyone have any ideas?

    Thanks,
    very frustrated access user

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,602
    You have date and time in separate Date/Time datatype fields in table? Query would look like:
    SELECT *, Table1.DateEnt, Table1.TimeEnt
    FROM Table1
    WHERE (((Table1.DateEnt)>=Date()-1) AND ((Table1.TimeEnt)>=#12/30/1899 5:0:0#));
    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
    sking89 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    6
    no, I have one field with general date format so date and time are together... but it wouldnt be hard to seperate them...

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,602
    You don't have to restructure the table but do need to extract the date/time parts for purpose of this query. Example:

    SELECT *, CDate(Format([DateAll],"mm/dd/yyyy")) AS D, CDate(Format([DateAll],"hh:nn:ss")) AS T
    FROM Table1
    WHERE (((CDate(Format([DateAll],"mm/dd/yyyy")))>=Date()-1) AND ((CDate(Format([DateAll],"hh:nn:ss")))>=#12/30/1899 5:0:0#));
    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.

  5. #5
    sking89 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    6
    YOU ARE MY HERO! Thank you soooo much!

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,602
    Actually, I did't get it quite right. That query will exclude records with a time earlier than 5 AM for every day. No need to extract the date/time parts after all. I think this is what you were looking for:
    SELECT * FROM Table1
    WHERE Table1.DateAll>=Format(Date()-1,"mm/dd/yyyy") & " 5:00:00 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
    sking89 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2011
    Posts
    6
    Sorry for the belated response. The second post worked great. Thank you so much for your help!

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

Similar Threads

  1. SQL Filter?
    By dev82 in forum Programming
    Replies: 4
    Last Post: 08-22-2011, 05:35 AM
  2. Slow response over VPN or To Filter or not To Filter
    By rcrobman in forum Database Design
    Replies: 0
    Last Post: 04-30-2011, 02:37 PM
  3. How do I filter on this ?
    By _Chris_ in forum Access
    Replies: 7
    Last Post: 08-12-2010, 08:34 PM
  4. Filter on #Num!
    By marley in forum Access
    Replies: 5
    Last Post: 07-28-2010, 06:59 AM
  5. VBA Filter
    By ntallman in forum Programming
    Replies: 7
    Last Post: 04-06-2010, 10:53 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