Sum function yields inconsistent results in footer

Posted on 2011-02-22
Last Modified: 2012-05-11

I have a report (Access 97) that contains two grouping headers  .  In the footer header of the Fullname group, I've added a calculated field that sums the work hours for all the OBS that are group by the fullname.  I've set the controlsource of the calculated field to = Sum([TotalWorkHours])   However I'm not getting the correct sums

     OBS      TotalWorkHOurs
Question by:chtullu135
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
LVL 31

Expert Comment

by:Helen Feddema
ID: 34956549
Use a textbox in the group footer with Sum() wrapped around the expression that calculates TotalWorkHours.  Here is an example, using TotalPrice:

LVL 31

Accepted Solution

Helen Feddema earned 500 total points
ID: 34956555
Also, make sure that you give your controls (or at least, any that are referenced in code) different names than their bound fields, to avoid circular reference errors.

Author Comment

ID: 34956574
I'm not calculating work hours.  Work hours come from the query that feeds the report.   In my example, I am using =Sum([TotalWorkHours]).  
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

LVL 31

Assisted Solution

by:Helen Feddema
Helen Feddema earned 500 total points
ID: 34956576
My LNC Rename add-in helps in the renaming process.  The Access 97 version (if you are still using that version) may be downloaded from this link:

Access 2000-2003 version:

Access 2007-2010 version:

LVL 31

Expert Comment

by:Helen Feddema
ID: 34956582
Is TotalWorkHours a calculated field in the report's record source?  If it is displayed in a control, what is the control's name?
LVL 31

Assisted Solution

by:Helen Feddema
Helen Feddema earned 500 total points
ID: 34956617
If TotalWorkHours is a calculated field in the record source, and if it is not displayed in a control with that same name, using Sum([TotalWorkHours] (or Sum(Nz([TotalWorkHours])) should work (in the group footer).

Author Comment

ID: 34957957
Hello Helen,
TotalWorkHours is not a calculated field.I've also changed the name of the control to txtTotalWorkHours.  I'm still getting inconsistent results
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 34964929
1. "I have a report (Access 97) that contains two grouping headers "
I believe you only mentioned "Full Name", what is the other, ...and what is the Hierarchy order?
If you have two groupings, then your sum will have to be in the Group footer of the outer-most group.

2. Can you please clearly define "inconsistent results"?
Wrong results always?
Wrong results on some records
Wrong results at random?

3. A picture is worth a thousand words".
Can you post a sample of this DB, and along with this, clearly the *exact* output you are expecting.
Sample database notes:
1. Back up your database(s).
2. Combine the front and back ends into one database file.
3. Remove any startup options, unless they are relevant to the issue.
4. Delete any objects that do not relate directly to the issue.
5. Remove any references to any "linked" files (files outside of the database, Images, OLE Files, ...etc)
6. Remove any references to any third party Active-x Controls (unless they are relevant to the issue)
7. Remove, obfuscate, encrypt, or otherwise disguise, any sensitive data.
8. Compile the code. (From the database window, click: Debug-->Compile)
9. Run the compact/Repair utility.
10. Remove any Passwords and/or security.
11. Post explicit steps to replicate the issue.
12. Test the database before posting.

In other words, a database that we can easily open and immediately see the issue.




Author Comment

ID: 34965479
Hello Helen,

I went back and redesigned the underlying query.  The original query seemed overly complex and consisted of multiple nested queries including an aggregation query.  When I simplified the design, the error disappeared.  I'm in the process of throughly testing the report to confirm that the problem is indeed fixed

Author Closing Comment

ID: 34982152
Although I solved my problem, you gave me some useful tips. Thanks again

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question