Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Join Date
    Apr 2007
    Posts
    45

    Angry Unanswered: Add Subreport Totals together

    I am at my wit's end! I have an unbound main report that contains two subreports. Each subreport has a text box in its footer that counts the total number of records using the =Count(*) as its control source.

    Here is the problem: I want to add another text box in the main report that will total the two subreport totals. This is what I have put into the control source for this text box:

    =[Report]![rsubDailyDownedEquipRepair]![Text14]+[Report]![rsubDailyDownedEquipPMs]![Text12]

    All this gets me is a Name? error in the text box. One of the subreports is based on a parameter query where it asks for the date, but this shouldn't make a difference, should it.

    What am I doing wrong?

  2. #2
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Isn't it Reports verses Report?


    =[Reports]![rsubDailyDownedEquipRepair]![Text14]+[Reports]![rsubDailyDownedEquipPMs]![Text12]
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  3. #3
    Join Date
    Apr 2007
    Posts
    45
    I tried it both ways - I first tried "Report" because the book I had told me to do it that way, and then I tried it with "Reports" - got the same results, so there must be something else I am doing wrong.

  4. #4
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    This is what I used and it worked in my test.
    Code:
    =[rptSubReport1].[Report]![Text0]+[rptSubReport2].[Report]![Text0]
    Because you are already within the main report, you should be able to just refer to the subreport control (rptSubReport1), and then the report within that control (.Report), then the field within that report (Text0)

  5. #5
    Join Date
    Apr 2007
    Posts
    45
    Yeah, I tried that one as well before I finally gave up and posted this thread. I still get the same result "Name?" I have checked and rechecked to make sure that my spellings are correct and so forth, so I can't figure out why it isn't working.

    Could the fact that one of my subreports prompts for a parameter (a date), have anything to do with my troubles? I don't see how it would be, but just thought I would give you all the facts in case that is what is causing the bug.

  6. #6
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    Jill, show us exactly what you tried, because what I gave you is right out of the text box that worked for me. But if I see what your code looks like, using this model, I think I will be able to see what needs to be changed.

  7. #7
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    jill,

    If you can upload an example, we can upload a fix rather quickly for you. I'm guessing offhand that the name might be wrong (it can't find the Text12 or Text14 field) - recommend naming these a little better (i.e. TotRepXYZ and TotRepZXX) or something other than TextXX. I'm assuming these fields are in the subreport's footer.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  8. #8
    Join Date
    Apr 2007
    Posts
    45

    Here is the database

    Okay, I think I found the problem, but don't know the solution. I will type out the formula with all the brackets, and then when I hit save, it wipes out all the brackets. Any idea why?
    Attached Files Attached Files

  9. #9
    Join Date
    Apr 2007
    Posts
    45
    Problem solved, but don't know why this would make a difference. Our local access guy came over, rewrote the formula by using the folders underneath the expression builder, and even though his formula looked exactly like mine - it works now!

  10. #10
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    Glad you got it solved. I looked at your database and that report and for the life of me, I have NO IDEA whatsoever why the typed formula does not work. I tried, and it would not work for me at all. If I knew Bill Gates I'd call him, but I don't so tell your Access guy "Thanks!"

  11. #11
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Boy this one really bothered me so I kept playing around with it. (not that it matters any more but I needed to make peace that it wasn't just an Access quirk.)

    I found that your first subreport is actually "Named": rsubDailyDownedEqiuipRepair verses rsubDailyDownedEquipRepair in the rptDailyDownedEquip report.

    rsubDailyDownedEq"I"uipRepair (notice the extra I after q). Look at the "Name" of what the subreport is actually called in rptDailyDownedEquip (not the actual report name.)

    Thanks again for the upload to figure this out.
    Last edited by pkstormy; 11-07-07 at 12:56.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  12. #12
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    Paul,
    Great job! I worked with this too, and thought I was using the clipboard to put in the names of the subreports, but I sure missed somewhere. Thanks for helping me feel much better about this!

  13. #13
    Join Date
    Apr 2007
    Posts
    45
    Yep, that was it. That would explain why my coworkers method worked as he was pulling the name from the folders where it was mispelled. Thanks!

  14. #14
    Join Date
    Dec 2004
    Location
    Madison, WI
    Posts
    3,926
    Quote Originally Posted by GolferGuy
    Paul,
    Great job! I worked with this too, and thought I was using the clipboard to put in the names of the subreports, but I sure missed somewhere. Thanks for helping me feel much better about this!
    Yeah I wasn't able to sleep for the last few nights thinking about this (had to double up on my ambien)

    It made me feel better knowing there was a reason.
    Expert Database Programming
    MSAccess since 1.0, SQL Server since 6.5, Visual Basic (5.0, 6.0)

  15. #15
    Join Date
    Apr 2007
    Posts
    45
    Okay, you have been so helpful with helping figure out this one bug, that I have another challenge for you. Same report. If you notice the rsubDailyDownedEquipPMs is built on a parameter query prompting for a date. The problem, when you go to print the report, you have to put the date in again - otherwise, it prompts for date when you open report and then when you hit print. I have never had this happen before in reports that were built on a parameter query. Is it because it is in a subreport that it is causing a problem?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •