Solved

Sum function yields inconsistent results in footer

Posted on 2011-02-22
10
246 Views
Last Modified: 2012-05-11
Hello,

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

FullName
     OBS      TotalWorkHOurs
0
Comment
Question by:chtullu135
  • 5
  • 4
10 Comments
 
LVL 31

Expert Comment

by:Helen_Feddema
Comment Utility
Use a textbox in the group footer with Sum() wrapped around the expression that calculates TotalWorkHours.  Here is an example, using TotalPrice:

=Sum(Nz([UnitPrice])*Nz([Quantity]))
0
 
LVL 31

Accepted Solution

by:
Helen_Feddema earned 500 total points
Comment Utility
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.
0
 

Author Comment

by:chtullu135
Comment Utility
I'm not calculating work hours.  Work hours come from the query that feeds the report.   In my example, I am using =Sum([TotalWorkHours]).  
0
 
LVL 31

Assisted Solution

by:Helen_Feddema
Helen_Feddema earned 500 total points
Comment Utility
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:
http://www.helenfeddema.com/Files/code4.zip

Access 2000-2003 version:
http://www.helenfeddema.com/Files/code10.zip

Access 2007-2010 version:
http://www.helenfeddema.com/Files/code63.zip

0
 
LVL 31

Expert Comment

by:Helen_Feddema
Comment Utility
Is TotalWorkHours a calculated field in the report's record source?  If it is displayed in a control, what is the control's name?
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 31

Assisted Solution

by:Helen_Feddema
Helen_Feddema earned 500 total points
Comment Utility
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).
0
 

Author Comment

by:chtullu135
Comment Utility
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
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
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?
...ect

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, ...post a database that we can easily open and immediately see the issue.

Thanks

JeffCoachman

0
 

Author Comment

by:chtullu135
Comment Utility
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
0
 

Author Closing Comment

by:chtullu135
Comment Utility
Although I solved my problem, you gave me some useful tips. Thanks again
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now