Results 1 to 11 of 11
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need Correct Report Total Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I have a Report with a unbound field, Name is Profit.

    This Profit field is calculated in Private Sub Detail_Format section of report and prints the result prints OK in the report.

    I trying to get a total of the Profit column in the Report Footer with Text Box, Control Source =Sum([Profit])

    When I run the report I get

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Need Correct Report Total Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I think you will find if you calculate the Profit value in a query, rather than on the report, then your text box will calculate the sum correctly.
    Wendell

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Need Correct Report Total Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Another option is to use a module-level variable SumProfit in the report module. Set this variable to 0 in the On Open event of the report. Use the same calculation you use in the On Format event of the Detail section to increase SumProfit:

    SumProfit = SumProfit + Profit

    where Profit is the amount you calculate.

    Use the On Format event of the report footer to set the Total text box to SumProfit:

    Me.TotalProfit = SumProfit

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Need Correct Report Total Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Does this take into account the Retreat feature?

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Need Correct Report Total Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    No.

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: Need Correct Report Total Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Should it?

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Need Correct Report Total Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Aren't you asking what you already know? <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Wendell's suggestion is probably the best solution, but you could test the FormatCount argument:

    If FormatCount = 1 Then
    SumProfit = SumProfit + Profit
    End If

  8. #8
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need Correct Report Total Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Hans

    I added a sub total that breaks on R/C in addition to Total.

    When I run the report with only 2 line items I get

    <pre>R/C Fee #Pl Receipts Profit Net Profit
    576 114.04 350 2,931.00 2,394.86 2,280.82
    576 87.01 131 2,695.00 1,827.21 1,740.20

    ST 201.05 481 5,626.00 4,222.07 4.021.02
    Tot 201.05 481 5,626.00 8,444.14 4.021.02
    </pre>


    The SubTotal is OK, however the Total is doubled

    When I run the report with all line items I get

    <pre>R/C Fee #Pl Receipts Profit Net Profit
    576 114.04 350 2,931.00 2,394.86 2,280.82
    576 87.01 131 2,695.00 1,827.21 1,740.20

    ST 201.05 481 5,626.00 1,827.21 4.021.02
    </pre>


    The SubTotal is missing the first 576 line item and the Total is 123,671.11 it should be 42,021.99

    The report works OK except for the Profit SubTotal and Total

    I have attached the report only in attached db, maybe it

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Need Correct Report Total Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I can't test since you didn't include the code for:

    gloGetValue
    gloSetValue
    Isolate_RevTran_MasterDetail_All_Transactions
    GetPref

  10. #10
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need Correct Report Total Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I realize that you can

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Need Correct Report Total Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>

Posting Permissions

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