Results 1 to 4 of 4
  1. #1
    QualityNurse is offline Novice
    Windows XP Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    1

    Setting up a query to give me a sum of dates from a collection of records in a month


    I have a table where someone can enter the date that a device was inserted and the date that the device was removed. I want to set up a query that will count how many days a device was present for a particular month. For example if there was one record that had a device inserted on 02/27/2014 and removed on 03/05/2014 and another record that had an insertion date of 02/28/2014 and a removal date of 03/10/2014 I would want to be able to run a query that would show me 3 days in February and 15 days in March. I am an access newbie so please make the answer as simple as possible

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Calculating the elapsed time between two dates is easy with DateDiff function.

    Breaking that up when the period crosses months or years is not.

    I am thinking this will require VBA code and a temp table.
    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
    mrojas is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2013
    Location
    Concord California
    Posts
    72
    I'm not sure I understand how you arrived at 3 days in February when the insertion date is 2/27 or 2/28 or how you get 15 day for March? Could you elaborate?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Total of 3 and 15 days for 2 devices. This gives a unit of device-days of service (like person-days of work).
    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.

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

Similar Threads

  1. Replies: 3
    Last Post: 11-16-2012, 10:15 AM
  2. Replies: 2
    Last Post: 10-19-2012, 01:44 AM
  3. Replies: 2
    Last Post: 09-29-2011, 12:50 PM
  4. Replies: 3
    Last Post: 12-23-2009, 08:50 AM
  5. Replies: 0
    Last Post: 08-04-2009, 08:51 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