Results 1 to 10 of 10
  1. #1
    Join Date
    Apr 2021
    Posts
    8

    Question Query to designate project At Risk/On Track based on activities being past due/on time


    My apologies in advance: I know just enough about Access to be dangerous. I have a table for projects & linked table for the activities related to each project. The goal is to create a query and/or report that will add a column to designate a project as "On Track" if the activities are on time or "At Risk" if any activities are past due. I have a formula in a query [/Condition: IIf([DateDone] Is Null And [DueDate]<Now(),"At Risk","On Track")] that designates the project as on track or past due, but I cannot get it to display correctly. It will successfully show me everything that is at risk OR everything that is on track when filtered for either option, but if I try to display both it displays duplicates, as in project number both on track and past due as many times as there are past due activities, and other fields go haywire displaying nonsense, Chinese symbols, Farsi, etc. . I am grateful for any guidance or direction.

  2. #2
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Can you post up the exact full sql of the query from the query designer?
    And possibly a picture of the query in the design window so we can see the tables.

    It sounds like a design issue or possibly that you need a sub query to give you the latest activity?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    use:
    IIf(isnull([DateDone]) And [DueDate]<date(),"On Track","At Risk")

    [field] is null ...is for query criteria

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    If you want a flag based on activity status, why not just use conditional formatting in the report or form? Set the textbox background to yellow if due within 2 days and red if it's past due - or something like that. No code, no query calculations required. If you're only interested in the project status it will be more complicated because you'll have to get the Max of activity due date and decide how to flag the project status based on that. IMO, the former is not only far easier, it makes it obvious as to which activities are responsible for any warning you might raise.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    You will get focused responses if you provide sample data with a clear description of your environment and your expected/desired result(s)?
    At Risk could be unlikely, possible, definite with relative associated consequences.
    It seems At Risk,Yes or No may not be reasonable???

  6. #6
    Join Date
    Apr 2021
    Posts
    8
    Quote Originally Posted by Minty View Post
    Can you post up the exact full sql of the query from the query designer?
    And possibly a picture of the query in the design window so we can see the tables.

    It sounds like a design issue or possibly that you need a sub query to give you the latest activity?

    Thanks for the quick response! It is highly likely to be a design issue, as I am stumbling through this out of sheer necessity.

    FYI, each project is a deviation, hence the "dev" references. Here is the SQL:
    SELECT DISTINCT Dev_Activities_Table.[Dev#], IIf([DateDone] Is Null And [DueDate]<Now(),"At Risk","On Track") AS Condition
    FROM Dev_Activities_Table
    WHERE (((IIf([DateDone] Is Null And [DueDate]<Now(),"At Risk","On Track"))="At Risk"));

  7. #7
    Join Date
    Apr 2021
    Posts
    8
    Thanks for the quick response! I tried your formula, but it works like mine. I can show either past due or on track, but displaying both displays duplicates.

  8. #8
    Join Date
    Apr 2021
    Posts
    8
    Quote Originally Posted by Micron View Post
    If you want a flag based on activity status, why not just use conditional formatting in the report or form? Set the textbox background to yellow if due within 2 days and red if it's past due - or something like that. No code, no query calculations required. If you're only interested in the project status it will be more complicated because you'll have to get the Max of activity due date and decide how to flag the project status based on that. IMO, the former is not only far easier, it makes it obvious as to which activities are responsible for any warning you might raise.
    Thanks for the quick response! The conditional formatting is built into the forms & reports used by folks everyday involved in each project, but management only wants to see the numbers: How many total, how many on track/past due, and so on. They don't want to scroll through each project to see that status, hence the report I am trying to create with those details at a glance. Right now I gather total number from the query for the project list table & the number past due from the activities table, manually, but I would prefer something to do it automatically.

  9. #9
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,793
    Best would be to copy, compact and zip the db. Remove or randomize sensitive data; include only what is needed to replicate the issue and post that here. Going back to your first post, it should be doable but it helps to be able to see the sql and data structure.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  10. #10
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    What happens if you remove the Distinct keyword and all of the where clause?

    SELECT Dev_Activities_Table.[Dev#], IIf([DateDone] Is Null And [DueDate]<Date(),"At Risk","On Track") AS Condition
    FROM Dev_Activities_Table


    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

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

Similar Threads

  1. Replies: 9
    Last Post: 07-02-2018, 11:01 AM
  2. Replies: 1
    Last Post: 04-09-2018, 12:35 PM
  3. Replies: 24
    Last Post: 09-09-2017, 09:38 AM
  4. Replies: 2
    Last Post: 01-15-2015, 07:34 PM
  5. Time Spent on Activities Report
    By avarusbrightfyre in forum Reports
    Replies: 1
    Last Post: 10-14-2010, 05:02 PM

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