Results 1 to 2 of 2
  1. #1
    zcavaricci is offline Novice
    Windows 8 Access 2016
    Join Date
    Nov 2018
    Posts
    1

    Count Consecutive Dates


    I am in the need of counting Consecutive Days for Patients Blood Glucose Checks. I need to know any instance of consecutive Dates >3 consecutive dates. But if there are more that 1 instance of that, just count it as 1 instance, not each time there is a consecutive days >3.


    Table A
    Patient_ID
    Date_Date
    A
    1/1/2018
    A
    1/2/2018
    A
    1/3/2018
    A
    1/4/2018
    A
    1/5/2018
    A
    1/8/2018
    A
    1/9/2018
    A
    1/10/2018
    A
    1/11/2018
    B
    1/1/2018
    B
    1/2/2018
    B
    1/3/2018
    B
    1/4/2018
    C
    1/1/2018
    C
    1/2/2018
    C
    1/3/2018
    Output
    Patient_ID
    # Instances Consec Dates
    A
    1
    B
    1
    C
    0

  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
    The only way that comes to mind would be a custom function. It would accept the patient as an input, open a recordset limited to that patient sorted by date. Loop through tracking each record against the previous and increment a counter when the dates are consecutive, reset it when they're not. Return 1 if the counter gets to 4, 0 if it doesn't.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Max of Consecutive Count
    By hptel83 in forum Access
    Replies: 1
    Last Post: 10-11-2017, 04:30 PM
  2. consecutive dates and like records
    By Jay1978 in forum Modules
    Replies: 5
    Last Post: 11-19-2015, 07:27 PM
  3. Count Consecutive Only
    By WickidWe in forum Queries
    Replies: 13
    Last Post: 12-16-2013, 02:33 AM
  4. Replies: 2
    Last Post: 07-29-2012, 05:52 PM
  5. multiple records with consecutive dates
    By sotssax in forum Forms
    Replies: 2
    Last Post: 07-26-2011, 04:23 AM

Tags for this Thread

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