locked
Total Text Box by Group RRS feed

  • Question

  • I have a textbox that totals another texbox.

    I have used this code (that I got here, thank you very much!) to total them, but now, instead of totaling the text box in the group, it gives a subtotal, of all of the instances of the text box, at the end of each group.  So instead of

    textbox4 103.00

    textbox4 103.00

    textbox4 86.00

    Total: 292.00

    at the end of the group, it will show 292.00 at the end of the next group, then the next group is:

    textbox4 103.00

    textbox4 60.00

    Total:  455.00

    I need it to total by group.

    This is the code in the custom code of the report:

    Dim public totalvalue as Integer
         Public Function Getvalue (ByVal itemvalue AS Integer ) AS Integer
                     totalvalue = totalvalue+ itemvalue
                     return itemvalue
        End Function
         Public Function PaidTot()
                     return totalvalue
         End Function

    In the PaidTot() textbox is this code:  =code.Paidtot()


    Gee

    Monday, November 12, 2012 12:10 AM

Answers

  • Hi Gee,

    I make a litter change to the code your post, please refer to the following custom code.

    Dim public totalvalue as Integer
    Dim public totalofgroup as Integer
    Public Function Getvalue (ByVal itemvalue AS Integer ) AS Integer
    totalvalue = totalvalue+ itemvalue
    return itemvalue 
    End Function 
    Public Function PaidTot()
    totalofgroup=totalvalue
    totalvalue=0   'reset the total value of the group
    return totalofgroup
    End Function

    Hope this helps.

    Regards,
    Fanny Liu


    Fanny Liu

    TechNet Community Support

    • Proposed as answer by Fanny Liu Thursday, November 15, 2012 10:48 AM
    • Marked as answer by Fanny Liu Monday, November 19, 2012 1:05 AM
    Tuesday, November 13, 2012 3:38 AM