Results 1 to 11 of 11
  1. #1
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86

    Calculations In Reports

    I have a somewhat complicated problem. I have been asked to create a database based on the spreadsheet. It has lots of calculations that I am not sure are possible in Access. So any help is appreciated.


    Employee Table: empid, empname
    Employee OHHours Table: empOHID, Dept, Date, OHhours1, OHhours2, OHhours3, OHhours4, OHhours5. -This table one to many with Employees
    Project Hours Table: EmpOHID, ProjectID, ProjectHours - This table one to many with Employee OHhours

    Here is the problem. I have employees overhead hours per month, which consists of several types of overhead hours. This is only one line per month, but I also have project hours which can entail several projects. I have a report with a sub report that totals these out by employee, then by department. On the employee level I can get the a total of overhead hours and project hours. But on the Department level where it needs to adds the hours together for all the employees in the department I can't seem to bring over the project hours.
    Here is the formula for the employee level which is working. =[Total_Overhead]+Nz([rpt_MONTHLY_SubRpt].[Report].[ProjectHours])
    When I tried to bring it down the department level, it did not recognize the subreport and bring back only the Total_Overhead.


    my formula is currently this =Sum([Total_Overhead]+Nz([rpt_PROJECT_TOTALS_sub].[Report].[SumofProjectHours]))
    SumofProjectHours comes from a hidden subreport I based off a query totaling the project hours. I put the subreport in the Department footer along with the other totals. I have spent two whole days trying to figure out what is wrong. I also need this same calculation on a grand total level for the whole report. There are also two other calculations on the employee level that work, but I have not been able to get them to work on the department level either. I sure I have something in the wrong place or something not right, I just can't seem to figure it out. Thanks for any help I can get on this.
    I have uploaded a screen shot of the spreadsheet I working from.
    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
    53,772
    Seeing spreadsheet doesn't help much. It is not a normalized db structure. Even your EmployeeOHHours table is not a fully normalized structure as indicated by multiple similar name fields.

    If you want to 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
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86

    Report Calculations

    Database is attached.
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    This expression works to pull value from subform:
    =Nz([rpt_PROJECT_TOTALS_sub].[Report].SumOfProjectHours])

    This also works:

    =Sum([Total_Overhead])+Nz([rpt_PROJECT_TOTALS_sub].[Report].[SumofProjectHours])
    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
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86

    RE: Calculations in Reports

    Quote Originally Posted by June7 View Post
    This expression works to pull value from subform:
    =Nz([rpt_PROJECT_TOTALS_sub].[Report].SumOfProjectHours])

    This also works:

    =Sum([Total_Overhead])+Nz([rpt_PROJECT_TOTALS_sub].[Report].[SumofProjectHours])

    When I tired the first one I get the results #Size! in the field. I must have tried this before, because I got this error before in my attempt to make this work. Not sure why I am getting this. I tried to change the field from general number to fixed, then to standard, but that did not help.
    On the second one I get an invalid syntax error.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    All I can say is those exact expressions worked for me in the db you posted.
    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
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86
    Quote Originally Posted by June7 View Post
    All I can say is those exact expressions worked for me in the db you posted.

    I changed it so there would always be at least a zero total for the project side, this took care of the #size! error, which had something to do with the fact that there was not always a project hours total.
    I got the formula you provided to give me a number, but it is only the overhead total which is 96. The total for the overhead plus the project total should be 516 for the CADD category. So it is not bring over the total from the sub report.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    The total I got was 116 (96 + 20).
    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.

  9. #9
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86
    Quote Originally Posted by June7 View Post
    The total I got was 116 (96 + 20).

    20 is just one of the project hours from one employee, I need the total for all employees in the category. which would be 96 + 420 for a total of 516. I did get it to bring back the 20. I tried to add sum to the beginning of the formula, but then no longer recognizes it.

    I am thinking the underlying query must not be set up right, any suggestions there? I am been working on this all afternoon and no luck.

  10. #10
    IrogSinta is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jun 2015
    Posts
    103
    I'm not sure why you have so many subreports for this. At the most, you really only needed 1 subreport. Now, if you make use of running sums, you don't even need a subreport. I've attached your revised db that demonstrates this method.

    Ron
    Attached Files Attached Files

  11. #11
    Njliven is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2012
    Posts
    86
    Quote Originally Posted by IrogSinta View Post
    I'm not sure why you have so many subreports for this. At the most, you really only needed 1 subreport. Now, if you make use of running sums, you don't even need a subreport. I've attached your revised db that demonstrates this method.

    Ron

    I want to thank you a million + times for all you help on this. It really is greatly appreciated.

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

Similar Threads

  1. Calculations in Reports - Nightmare!
    By PappyEnza in forum Reports
    Replies: 2
    Last Post: 06-16-2014, 02:05 PM
  2. Calculations on reports
    By holysepulchre in forum Reports
    Replies: 5
    Last Post: 01-10-2013, 02:35 PM
  3. Calculations on reports
    By BigMac4 in forum Reports
    Replies: 3
    Last Post: 09-14-2012, 02:33 PM
  4. Calculations in reports
    By bvanscoy678 in forum Reports
    Replies: 4
    Last Post: 08-05-2010, 06:27 AM
  5. Replies: 14
    Last Post: 06-03-2010, 06:03 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