Results 1 to 7 of 7
  1. #1
    shod90 is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Posts
    134

    Get time between a specific day from the previous month to our current date

    Dear Gents ,
    I have a report that i have to show records from a specific day of the previous month till our current date , So if the specific day is 25 , I need to show the records from 25th of July till 17th of Aug .

    I tried many solutions but no hope , I only know how to do manually Between #7/25/2016# And Date() but i need it to be dynamically updated

  2. #2
    Gina Maylone is offline Always learning
    Windows 7 64bit Access 2013
    Join Date
    Jun 2013
    Location
    Afton, MN
    Posts
    544
    Create a form with an unbound field "StartDate" where you will enter the specific date you need to report on. Reference the form/field in your query criteria.
    Code:
    SELECT REsidentVitals.REsidentID, REsidentVitals.DateTaken
    FROM REsidentVitals
    WHERE (((REsidentVitals.DateTaken)=[Forms]![Form1]![startdate]));
    Hope this helps.

  3. #3
    shod90 is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Posts
    134
    Thanks for your response , But i don't need that actually.
    I need when the user log in to the main page it automatically calculates the total hours of what he worked from 25th of the previous month till today.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    so you need to calculated a 25th of the previous month value from today? What if today is 26th of August? do you want 25th July or 25th August?

  5. #5
    shod90 is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Posts
    134
    if today is 26th of August then the calculation should start from 25th August .

  6. #6
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    something like

    SELECT sum(workhours)
    FROM MyTable
    WHERE workdate between dateadd("d",25-day(date()),dateadd("m",day(date())<=25,date())) and Date()

  7. #7
    shod90 is offline Competent Performer
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Posts
    134
    MANY THANKS it works !!! , See? it's very complicated

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

Similar Threads

  1. Replies: 3
    Last Post: 05-10-2016, 11:51 AM
  2. Replies: 3
    Last Post: 03-02-2016, 09:39 AM
  3. Replies: 2
    Last Post: 02-12-2015, 05:14 AM
  4. Replies: 2
    Last Post: 01-16-2015, 04:22 PM
  5. How to get a specific number for the current month?
    By Ronald Mcdonald in forum Access
    Replies: 1
    Last Post: 06-14-2012, 11:55 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