Results 1 to 6 of 6
  1. #1
    cp3 is offline Novice
    Windows 10 Access 2021
    Join Date
    Mar 2023
    Posts
    13

    Rolling date check in Query

    I have a database with many columns pertaining to dates (I.E. a 3 mnth check in column, 6 mnth check in column, 9 mnth column etc...). I want to be able to pull missing data with a query specially aimed at certain time frames. For example, I'd like to pull all of the records who were missing their most recent check in, however the records are not all on the same check in. Records were entered in batches on a rolling scale so some are on their 3mnth check in column, and others are on their 6 mnth, 9mnth etc....

    I am totally stumped on this. How would I create a query that pulls every record that missed their most recent check in without excluding other records since they might have been included in the study at a different time. I am just starting out in Access and everyone's input is so helpful! I definitely wouldn't be as far as I am without this forum!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Could you provide db for analysis? Follow instructions at bottom of my post.
    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
    cp3 is offline Novice
    Windows 10 Access 2021
    Join Date
    Mar 2023
    Posts
    13
    Unfortunately I cannot do that. This database has confidential data and cannot be removed from the network it is stored on. But if you have any advice for this question or perhaps explain your approach here I would much appreciate it

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,938
    Your issue is because you do not have a normalized database.

    Generally to get around such a badly designed db, you need to create a union query with as many query statements as you have columns, for the data you are trying to interrogate.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Don't need real data, just realistic data. You could build dummy db to provide structure and some simple data for testing. Or build tables in forum post with the Advanced editor. Help us help you.

    How do you determine checkin dates? Are these calculated from date enrolled in program? Enrollment date of 2/11/2023 would have 3-month date of 5/11/2023?

    Checkin is missed if field is empty and calculated date is passed?

    Consider:
    Code:
    SELECT ID, EnrollDate, DateAdd("m",3,[EnrollDate])<Date() And [Mon3] Is Null AS M3, DateAdd("m",6,[EnrollDate])<Date() And [Mon6] Is Null AS M6
    FROM Table1
    WHERE (((DateAdd("m",3,[EnrollDate])<Date() And [Mon3] Is Null)=True)) OR (((DateAdd("m",6,[EnrollDate])<Date() And [Mon6] Is Null)=True));
    or
    Code:
    SELECT * FROM (
    SELECT ID, EnrollDate, "M3" AS Per, Mon3 AS DateReview, DateAdd("m",3,[EnrollDate])<Date() And [Mon3] Is Null AS IsMissed FROM Table1
    UNION SELECT ID, EnrollDate, "M6", Mon6, DateAdd("m",6,[EnrollDate])<Date() And [Mon6] Is Null FROM Table1) AS DataUNION
    WHERE IsMissed;
    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.

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,938
    Quote Originally Posted by cp3 View Post
    Unfortunately I cannot do that. This database has confidential data and cannot be removed from the network it is stored on. But if you have any advice for this question or perhaps explain your approach here I would much appreciate it
    Use this. https://www.accessforums.net/showthr...t=randomize#19
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

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

Similar Threads

  1. Rolling average not based on date range
    By hakannordell in forum Queries
    Replies: 3
    Last Post: 12-16-2021, 02:26 AM
  2. Replies: 2
    Last Post: 04-29-2014, 03:04 AM
  3. Replies: 4
    Last Post: 02-03-2014, 12:16 PM
  4. In query check for NO date
    By burrina in forum Queries
    Replies: 2
    Last Post: 02-07-2013, 12:21 AM
  5. Rolling 12 or 6 Month Query
    By Shakenaw in forum Access
    Replies: 2
    Last Post: 09-22-2011, 09:24 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