Results 1 to 9 of 9
  1. #1
    GregRemaly is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2014
    Posts
    4

    Assist with results

    The query I put together isn't returning the results I expected. Here is the query:

    SELECT DISTINCT [Followup Grid].REGION, [Followup Grid].ENTITY, [Followup Grid].[CITY/STATE] AS LOCATION, [Followup Grid].[ISSUE ID], [Followup Grid].[FOLLOW UP STATUS]
    FROM [Followup Grid]
    WHERE ((([Followup Grid].[FOLLOW UP STATUS])="NOT DUE") AND (([Followup Grid].SYSTEM)="XYZ Health") AND (([Followup Grid].[REPORT STATUS])="Final report signed"))
    GROUP BY [Followup Grid].REGION, [Followup Grid].ENTITY, [Followup Grid].[CITY/STATE], [Followup Grid].[ISSUE ID], [Followup Grid].[FOLLOW UP STATUS]
    HAVING ((([Followup Grid].[FOLLOW UP STATUS])="NOT DUE"))
    ORDER BY [Followup Grid].REGION, [Followup Grid].ENTITY, [Followup Grid].[CITY/STATE];

    My expectation is to get a listing of all unique "NOT DUE" issues. Instead, I'm getting more. Issues "ISSUE ID" can have more than one action plan. I have two issues that have an action plan that have a "FOLLOW UP STATUS" of "NOT DUE" and "PAST DUE". If an issue has a "PAST DUE" status, then it is a past due issue and shouldn't be included.

    How can I get the query to exclude "ISSUE IDs" that have a "FOLLOW UP STATUS" of "PAST DUE" and "NOT DUE"?

    I appreciate any help with this.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    If you are not adding numbers, dont use the GROUP BY. TURN OFF SUMMATION.
    Make sure if you dont want the field to show, then use WHERE, not GROUP.

  3. #3
    GregRemaly is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2014
    Posts
    4
    I am adding numbers in the next query I'm using to total up all of the NOT DUEs. My numbers are wrong because the there are two issues that have two follow up statuses, NOT DUE and PAST DUE.

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    You have [FOLLOW UP STATUS] as a GROUP and a WHERE. You only need 1.

    did you want:
    "PAST DUE" or "NOT DUE"

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I am confused...

    You have
    Code:
    WHERE [Followup Grid].[FOLLOW UP STATUS] = "NOT DUE" AND 
    [Followup  Grid].SYSTEM = "XYZ Health" AND 
    [Followup Grid].[REPORT  STATUS] = "Final report signed"
    But then you ask
    How can I get the query to exclude "ISSUE IDs" that have a "FOLLOW UP STATUS" of "PAST DUE" and "NOT DUE"?
    Does "Issue IDs" also have "PAST DUE" and "NOT DUE" as values?
    A few examples of the data would help...


    I would start out like ranman256 suggested:
    Code:
    SELECT DISTINCT [Followup Grid].REGION, [Followup Grid].ENTITY,  [Followup Grid].[CITY/STATE] AS LOCATION, [Followup Grid].[ISSUE ID],  [Followup Grid].[FOLLOW UP STATUS]
    FROM [Followup Grid]
    WHERE [Followup Grid].[FOLLOW UP STATUS] = "NOT DUE" AND [Followup  Grid].SYSTEM = "XYZ Health" AND [Followup Grid].[REPORT  STATUS] = "Final report signed"
    When this first query returns the correct (expected) records, use the 1st query as the source for the 2nd query - the totals query.




    A couple of other suggestions:
    Do not use punctuation or special characters (underscore is the exception) in object names
    Don't use all caps.
    Do not use spaces in object names. If you must separate words, use the underscore.

    Examples:
    [FollowupGrid].[FollowUpStatus]
    [FollowupGrid].[Follow_Up_Status]

    [FollowupGrid].[CityState]
    [Followup Grid].[City_State]

  6. #6
    GregRemaly is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2014
    Posts
    4
    Sorry, this is hard to explain.

    I attached some sample data. I scrubbed it a little so that you can see enough to maybe get me where I need to be.

    Long story, but I put together a Follow Up report monthly and I'm trying to improve the summary. I'm from an internal audit firm where audits generate audit issues. Issues require action plans to correct the issue identified. Our automated system generates a data dump that I import into Access to run reports.

    In the sample data, you will see that the Issues with ISSUE ID 13081 and 13082 (highlighted yellow) had two action plans each. Neither action plan is complete while the action plans with the ACTION PLAN ID 14981 and 14984 are past due.

    The summary report I'm running includes several regions, several departments and needless to say, several issues and action plans. The summary report I am putting together is on the second tab. I am running individual queries for counting the number of issues, number of NOT DUEs, PAST DUEs, WNBI and COMPLETE. My summary works fine the way I have it except for this once circumstance where there is a past due and a not due action plan for an individual issue. I highlighted where the count returns a value of 4 NOT DUE issues when I need it to return a value of 2.

    I apologize for having spaces and capital letters and all of the other formatting issues you describe. Maybe that will be the next thing I tackle when I get the summary put together.

    Again, I appreciate the help on this. If I can get this one thing fixed, then the Summary report I need to complete will be finished.
    Attached Files Attached Files

  7. #7
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Excel sheet helps, but what about the dB?

  8. #8
    GregRemaly is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Oct 2014
    Posts
    4
    The DB is pretty big and includes confidential info that I just cannot include.

    Is there another way?

  9. #9
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I tried to create a table using your data from the spreadsheet to test the query, but data/fields are missing.

    It looks like the record source for the query is a single table. Create a copy of the dB, with the one table and query. Cchange sensitive data, leave only enough records for testing (like your example).

    Can't see anything major wrong with the query..... (but then again, I'm not a query Jedi )

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

Similar Threads

  1. Replies: 2
    Last Post: 01-02-2014, 02:33 PM
  2. Email doublespacing, vba assist
    By redbull in forum Programming
    Replies: 3
    Last Post: 03-18-2013, 01:58 PM
  3. Senseless, but please assist
    By djclntn in forum Queries
    Replies: 7
    Last Post: 11-21-2011, 07:02 PM
  4. Please assist on this task. I'm stuck.
    By Playerpawn in forum Access
    Replies: 3
    Last Post: 05-17-2011, 01:31 PM
  5. **I need Help with EXCEL. Please Assist**
    By n in forum Import/Export Data
    Replies: 0
    Last Post: 06-23-2006, 10:08 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