Results 1 to 4 of 4
  1. #1
    akibasaimon is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2013
    Posts
    2

    How to pull data between two dates and only at a certain time of each day?


    Hi All,

    The company I work for has 2 shifts. The managers on the different shifts want to be able to look at the data for their shift only. Therefore I've been working on trying to create the code to allow our users to search for data between specific date parameters (i.e a week) and for each day of that week to only look between a specific time range (i.e 09:00 to 17:00). The date parameters can be selected by the user while the time parameters are preset to certain intervals.

    Any ideas how this can be done?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    With no idea of your structure, I'd suggest looking at DateValue() and TimeValue(), along the lines of:

    SELECT...
    FROM...
    WHERE DateValue(DateTimeField) Between Date1 And Date2 AND TimeValue(DateTimeField) Between Time1 And Time2
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    If there are only two shifts, you can also consider just marking the database records with a shift code. After that was done, any query could just use a filter on shift code, if the user wanted only one shift to be displayed.

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I'd go with pbaldy's method. You can make the default time range based on the time the report is run, so if it's between 9 and 5 filters one way, if it's after 5pm it filters another

    Filtering can either be done using the filter property of the report or through the query running the report.

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

Similar Threads

  1. Pull Data from another table
    By bbranco in forum Access
    Replies: 1
    Last Post: 06-19-2013, 06:15 AM
  2. Replies: 1
    Last Post: 01-14-2013, 11:28 AM
  3. Replies: 1
    Last Post: 12-07-2012, 10:02 AM
  4. How can pull this data?
    By cap.zadi in forum Queries
    Replies: 21
    Last Post: 01-23-2012, 03:09 AM
  5. Replies: 10
    Last Post: 11-16-2011, 10:58 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