Results 1 to 8 of 8

Thread: Report Totals

  1. #1
    Join Date
    May 2007
    Posts
    31

    Unanswered: Report Totals

    Hi all ~

    I have a report with a subreport. The subreport contains a value which i want to use in a report total.

    I can get the last entry to display but as soon as i put the =sum([feildname]) i get prompted to enter a value and then that value is incremented by the number of subreport instances. So if i enter 150 and there are 2 subrecords the report displays 300.

    Any help would be appreicated.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    you need to either push or pull the value to/into the main report
    I don't know if you do it directly from sub report to main report control, you may need to store the value in a variable in the sub report

    to push a value
    declare a variable in the main report
    then set that value by pushing the value from your sub report

    say you called your
    mainreport called MyMainReport
    the sub report is called MySubReport
    variable declared in the main report as MyVariable
    and the name of the control containing the contents your required was MyControl


    eg forms!MyMainReport!MyVariable = forms!mysubreport!mycontrol

    you would need to put that code in the sub reports on group footer on format event
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    May 2007
    Posts
    31
    do you have an example of this - i've never put code on a report before....

    thanks!

  4. #4
    Join Date
    Sep 2006
    Posts
    265
    If you put a Sum function of the feild you want to total on the SubReport Footer, Name it, 0 Height and Visible = False and then reference this in your main report you should get the right total.

    Simon

  5. #5
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    0 Height and Visible = False
    Overkill? Why set zero height??
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  6. #6
    Join Date
    Sep 2006
    Posts
    265
    The Subform's Totals don't need to be printed so they don't need to shown so hide them completely. In most cases this does not really matter but with customised stationery it might.

    Simon

  7. #7
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Still no reason to do both. Just set Visible = False, no need to zero height it as well imo. When I hide an object I almost always colour it "yukky orange" and set it invisible. That way I can tell immediately where my hidden objects are... and I know the form has hidden objects just by looking at it too.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  8. #8
    Join Date
    Sep 2006
    Location
    Surrey, UK
    Posts
    995
    Provided Answers: 2
    When I hide an object I almost always colour it "yukky orange" and set it invisible.
    Never thought of that!

Posting Permissions

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