Results 1 to 7 of 7
  1. #1
    hilian is offline Advanced beginner
    Windows XP Access 2003
    Join Date
    May 2012
    Posts
    44

    Exclamation Can sum on only one of two group footers

    I am summing the results of a calculated field from a query in a report. The report is grouped at two levels, and I need to sum at two levels. The amounts I am summing are expenditures by social service agencies. Each agency has several programs. I need a sum for each program and then for each agency. I am able to get a sum for program by putting the field (called Expr10) in the Program group footer. However, when I try to sum the sums by putting the field in the Agency group footer, I get the error message, “Data type mismatch in criteria expression.” I’ve tried it several ways: by simply putting the field in the Agency footer; by putting it in the footer and changing the Running Sum property to “over group;” and by using the formula =sum([Expr10]). I can also put the field in the Agency group footer without putting it in the Program group footer, and it will work. But I can’t put it in both places. I’ve tried other fields in the report, and I can get sums at both levels, just not Expr10. Can anybody help?



    Thanks,

    Henry

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Want to provide the project for analysis? Follow instructions at bottom of 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
    hilian is offline Advanced beginner
    Windows XP Access 2003
    Join Date
    May 2012
    Posts
    44

    Exclamation Thank you. file attached

    Quote Originally Posted by June7 View Post
    Want to provide the project for analysis? Follow instructions at bottom of post.
    I have attached a zipped copy of the application. I'll be grateful for whatever you find out. Thanks
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    I get the type mismatch no matter where I put the calculation, one or both at a time. At the root of this error is the HeavyDutyCleaning field. It is text instead of number type. Fix the type and the calc works.

    Why do you have records in the group footer instead of detail section? This means only the first record of each group is displayed. For example: group 'Agency Number 1: Program Number: 1' shows one record with 1 bunk bed and 1 toddler bed but the number of requests total is 18. Is that the display you want? If what you want are totals for each fee type, then try: instead of textboxes bound directly to the fee type fields, use expression: Sum(IIf([Decision]="Approve", [Full$165],0)). Name the textboxes different from the referenced field to avoid circular reference error, like tbxFull.

    The data structure is not normalized and you are hard-coding rates into the field names and calculations. What if rates change?

    Should avoid use of spaces, special characters (such as $), punctuation (underscore is exception) in field names and no reserved words as field names.
    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
    hilian is offline Advanced beginner
    Windows XP Access 2003
    Join Date
    May 2012
    Posts
    44
    Quote Originally Posted by June7 View Post
    Want to provide the project for analysis? Follow instructions at bottom of post.
    Thank you so much for your careful explanation. The data structure was set up by somebody else in Excel. I thought that Access would be much better for maintaining data integrity, but I didn't want to make too many changes in what people were used to. I see why it's important, to make those changes, though. I'll work through your suggestions and report back.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    You might want to review the 'sticky' thread tutorials found at http://forums.aspfree.com/microsoft-access-help-18/
    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
    hilian is offline Advanced beginner
    Windows XP Access 2003
    Join Date
    May 2012
    Posts
    44

    Thumbs up

    I went back to the data table and changed the HeavyDutyCleaning field to number. Access must have interpreted it as text when I imported the table from Excel. I never thought to look. Now I know. I used the expression, Sum(IIf([Decision]="Approve", [Expr10],0)), and it summed in both footers. I am now reviewing the sticky thread tutorials. Very useful.

    Many thanks,

    Henry
    Last edited by hilian; 05-20-2012 at 07:01 AM. Reason: I couldn't find the place to mark the thread as solved.

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

Similar Threads

  1. Group and Sum
    By leftcoast in forum Queries
    Replies: 5
    Last Post: 08-31-2011, 04:30 PM
  2. query group by over another group by?
    By gap in forum Queries
    Replies: 2
    Last Post: 07-04-2011, 12:59 AM
  3. Replies: 5
    Last Post: 11-29-2010, 08:16 AM
  4. how to group?
    By wconan in forum Access
    Replies: 2
    Last Post: 03-08-2010, 09:44 PM
  5. columns for group detail but not group header?
    By Coolpapabell in forum Reports
    Replies: 0
    Last Post: 08-21-2009, 08:53 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