Results 1 to 8 of 8
  1. #1
    jlarks is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Nov 2014
    Posts
    6

    Exclamation Need Help with Writing a Single and Aggregate Report

    Hello

    What I'm really trying to do is as follows:



    1. Create a form for data entry in access (see attached).

    2. Create a report that calculates "Yes", "No", "NA" and the "Percentage" for each category for each entry per location (see attached).

    3. Create an aggregate report for all entries for all locations.

    I'll be willing to pay you for your assistance with this project because I've spent all weekend trying to get it done and I'm back to square one i.e. creating the form with lookup tables as you have suggested. Please advise accordingly. Thanks!

    Signed

    Desperate in Delaware
    Attached Files Attached Files

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    50,339
    The QuarterlySafetyCheck table is not a normalized data structure. Joining that table to tblResponses would require 12 copies of tblResponses in the query, each linked to one of the response fields. Including tblQuestions in the query makes no sense at all.

    The query would have to calculate a Yes, No, N/A field for each of the response fields. Following example is for only the AlarmSystem field:

    AlarmYes: Sum(IIf([AlarmSystem]=1,1,0))
    AlarmNo: Sum(IIf([AlarmSystem]=2,1,0))
    AlarmNA: Sum(IIf([AlarmSystem]=3,1,0))
    AlarmYesPct: Sum(IIf([AlarmSystem]=1,1,0))/Count(*)*100
    AlarmNoPct: Sum(IIf([AlarmSystem]=2,1,0))/Count(*)*100
    AlarmNAPct: Sum(IIf([AlarmSystem]=3,1,0))/Count(*)*100

    SELECT QuarterlySafetyCheck.ReviewDate, QuarterlySafetyCheck.Location, QuarterlySafetyCheck.Reviewer, QuarterlySafetyCheck.Title, Sum(IIf([AlarmSystem]=1,1,0)) AS AlarmYes, Sum(IIf([AlarmSystem]=2,1,0)) AS AlarmNo, Sum(IIf([AlarmSystem]=3,1,0)) AS AlarmNA, Sum(IIf([AlarmSystem]=1,1,0))/Count(*)*100 AS AlarmYesPct, Sum(IIf([AlarmSystem]=2,1,0))/Count(*)*100 AS AlarmNoPct, Sum(IIf([AlarmSystem]=3,1,0))/Count(*)*100 AS AlarmNAPct
    FROM QuarterlySafetyCheck
    GROUP BY QuarterlySafetyCheck.ReviewDate, QuarterlySafetyCheck.Location, QuarterlySafetyCheck.Reviewer, QuarterlySafetyCheck.Title;

    Then bind report to the aggregate query.

    Or bind report to the raw data and use report Grouping & Sorting features with aggregate calcs in textboxes in section footers.

    Really need to consider restructuring database to normalize, like:

    tblReviews
    ReviewID (primary key)
    ReviewDate
    Location
    ReviewerID (should probably have a table for Reviewers with ID, Name, Title)

    tblReviewResponses
    ReviewID (foreign key)
    QuestionID (foreign key)
    Response (I would not save the ID for each response, I would save the descriptive text "Yes", "No", "NA". This will simplify queries.)
    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
    jlarks is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Nov 2014
    Posts
    6
    Thank you for your thorough response, I realize that you said that the table is not a normalized data structure and makes not sense at all. What I need to know is:

    1. How I would normalize the table data structure to get the report I am trying to design?
    2. Obviously you're not suggesting that I take the more complex route that you've taken the time to write below, so, is there any easier way?

    The QuarterlySafetyCheck table is not a normalized data structure. Joining that table to tblResponses would require 12 copies of tblResponses in the query, each linked to one of the response fields. Including tblQuestions in the makes no sense at all.

    The query would have to calculate a Yes, No, N/A field for each of the response fields. Following example is for only the AlarmSystem field:

    AlarmYes: Sum(IIf([AlarmSystem]=1,1,0))
    AlarmNo: Sum(IIf([AlarmSystem]=2,1,0))
    AlarmNA: Sum(IIf([AlarmSystem]=3,1,0))
    AlarmYesPct: Sum(IIf([AlarmSystem]=1,1,0))/Count(*)*100
    AlarmNoPct: Sum(IIf([AlarmSystem]=2,1,0))/Count(*)*100
    AlarmNAPct: Sum(IIf([AlarmSystem]=3,1,0))/Count(*)*100

    SELECT QuarterlySafetyCheck.ReviewDate, QuarterlySafetyCheck.Location, QuarterlySafetyCheck.Reviewer, QuarterlySafetyCheck.Title, Sum(IIf([AlarmSystem]=1,1,0)) AS AlarmYes, Sum(IIf([AlarmSystem]=2,1,0)) AS AlarmNo, Sum(IIf([AlarmSystem]=3,1,0)) AS AlarmNA, Sum(IIf([AlarmSystem]=1,1,0))/Count(*)*100 AS AlarmYesPct, Sum(IIf([AlarmSystem]=2,1,0))/Count(*)*100 AS AlarmNoPct, Sum(IIf([AlarmSystem]=3,1,0))/Count(*)*100 AS AlarmNAPct
    FROM QuarterlySafetyCheck
    GROUP BY QuarterlySafetyCheck.ReviewDate, QuarterlySafetyCheck.Location, QuarterlySafetyCheck.Reviewer, QuarterlySafetyCheck.Title;

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    50,339
    1. suggested structure in previous post

    2. whether the expressions are in query or in textboxes on report, still have to build them: 6 expressions * 12 fields = 72
    That would be a very long query statement.
    Normalize. Reduce to about 7 expressions.
    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.

  5. #5
    jlarks is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Nov 2014
    Posts
    6
    Thanks for your response, however, I don't know how to "normalize" the tables to build a query. Can you advise further please?

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    50,339
    I gave you suggestion for normalized table structure at the end of post 2.
    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.

  7. #7
    jlarks is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Nov 2014
    Posts
    6
    Moderator, I'm still trying to figure this out and obviously I'm not knowledgeable as you are about Access or databases. I'm willing to pay you for your assistance to help me resolve this issue. I'm desperate and I have to complete this project yesterday. Please advise accordingly. Thank you for your consideration.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    50,339
    What do you not understand about the two suggested tables to normalize data structure? Maybe this tutorial site will help you understand http://www.rogersaccesslibrary.com/

    I don't take payment for participating in forum site.
    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. Exporting Report to PDF specific location on quit - over-writing existing
    By augcorv@gmail.com in forum Import/Export Data
    Replies: 13
    Last Post: 03-21-2014, 02:08 PM
  2. Replies: 1
    Last Post: 05-27-2013, 08:54 AM
  3. Subtracting aggregate fields in a report
    By ProjectHelp in forum Access
    Replies: 6
    Last Post: 03-21-2012, 10:48 PM
  4. Writing a forumla for a report
    By sai_rlaf in forum Reports
    Replies: 2
    Last Post: 08-05-2011, 12:26 PM
  5. Exporting single query and single report.
    By rfhall50 in forum Programming
    Replies: 2
    Last Post: 02-18-2011, 12:08 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