Results 1 to 5 of 5
  1. #1
    wolfm is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Dec 2013
    Posts
    93

    Multiple Date Query not Working

    Hello:
    I have a table 'Truck Runs' and a query 'OT Query'. I want the 'OT Query' to pull the truck runs for a specified time frame, and of those, list only the truck runs delivering before 8:00 am and after 4:30 pm. So, I want my report to count the number of truck runs on overtime (before 8 am and after 4:30 pm)

    If I only have the date range in the query, it works fine. But, when I add the overtime column to the query, nothing comes up.
    Am I formatting the date criteria correctly, or are the two pieces of information just conflicting with each other?



    Attached is a shot of my query. Thank You!!

    Click image for larger version. 

Name:	OT Query.JPG 
Views:	10 
Size:	28.0 KB 
ID:	33012

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    Try putting OR instead of AND in your TimeOfDelivery criteria.

    You could also try

    Between #4:30:00 PM# and #8:00:00 AM# as the TimeOfDelivery criteria

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,920
    Maybe:

    <#8:00:00 AM# Or >#4:30:00 PM#

    or

    NOT Between #8:00:00 AM# AND #4:30:00 PM#

    or

    NOT (>#8:00:00 AM# AND <#4:30:00 PM#)


    I don't recommend popup input parameters - can't validate input. Should do input on form and reference controls as parameters.
    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.

  4. #4
    wolfm is offline Advanced Beginner
    Windows 7 32bit Access 2013
    Join Date
    Dec 2013
    Posts
    93
    Thanks to both! Makes a lot of sense, and it worked! It was an instant fix. Thanks Again!

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725

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

Similar Threads

  1. Date query not working
    By JimO in forum Queries
    Replies: 6
    Last Post: 06-10-2016, 02:36 PM
  2. Date() function not working in query
    By riggsdp in forum Queries
    Replies: 8
    Last Post: 02-05-2015, 02:33 PM
  3. Date query not working
    By wolfm in forum Queries
    Replies: 2
    Last Post: 06-06-2014, 08:39 AM
  4. Replies: 3
    Last Post: 03-11-2014, 07:32 PM
  5. Replies: 3
    Last Post: 09-19-2012, 08:59 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