Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004

    Unanswered: I could not sum the textbox in report ,Help me please ... [edited My latest thread]

    I have missed for posting the latest thread
    But i have already edited in this thread ...

    I have 2 textboxs.
    First textbox is in detail section
    Second textbox is in GroupFooter0 section

    The value of first textbox got from the calculation of my function
    My purpose is I want to give the second textbox show the summation of first textbox .

    I used to use Sum([first textbox]) on Control Source of the second textbox
    But It occured the input dialog and show the name of first textbox before show the report (the input dialog show after click open the report ,But if i have not input any value into the input dialog Would cannot open the report.)
    What cause does this problem has ?

    So, I have written another function for sum first textbox (cuz Could not sum with Sum([first textbox]) )
    The code of last function is:

    Function SumMPay(longMPay As Long) As Long
    Dim i As Integer
    Set dbs = CurrentDb()
    Set rst = dbs.OpenRecordset("select deb_id from deb_list where deb_month= " & Reports![Deb_List_Report_By_Month]![Deb_Month] & " and deb_year = " & Reports![Deb_List_Report_By_Month]![Deb_Year])

    For i = 1 To rst.RecordCount
    SumMPay = SumMPay + longMPay
    Next i

    End Function
    I have used this function at :

    Private Sub GroupFooter0_Print(Cancel As Integer, PrintCount As Integer)
    second textbox = SumMPay(first textbox)
    End Sub
    Now Can open the report without any input dialog...
    If that report just has a record , The value would been correct
    But If that report has more than 2 records , The value would been incorrect :O *
    I used to put the second textbox on PageFooterSection
    By use Sum([first textbox])

    But the value of second textbox is "#Error"
    I have tried put the second textbox on PageFooterSection again
    But i used SumMPay function.

    Then it was incorrect yet like put in GroupFooter
    (I have changed the code to
    "Private Sub PageFooterSection_Print(Cancel As Integer, PrintCount As Integer)
    Me.SumM1Pay = SumMPay(Me.M1Pay)
    End Sub" too)

    Which wrong?
    Anyone have any idea ?

    Please Help me
    I am using winxp + office 2k sp3

    Thank you very much again

  2. #2
    Join Date
    Jun 2004
    hi, not sure what you wanted exactly.. but if you want every subsequent fields in the report to reflect as the running sum of the values above the record, simply toggle the running sum option of the field to "over group" or "overal all"

    hope this is what you wanted.


  3. #3
    Join Date
    Dec 2003
    Dallas, TX
    Hi iBug,

    Your situation seems still a bit unclear which could possibly resolved easier if you create a Copy of your DB/Report, apply some dummy data to it and Zip/Post it here. But just from my initial observation seems you are referring to the container field in the calculation itself:

    SumMPay = SumMPay + longMPay

    You're saying in the above line this: For the TextBox [SumMPay] that is = Itself + the [longMPay] field. It would seem to me you should have 2 fields calculation done in a TextBox, not sum it in the Field itself. It's like this, you have 2 fields:
    [Qty] and [Cost]
    You want the Sum of those two fields so you simply Add a TextBox to hold the resulting calculation like this in the DetailSection:

    Next, create a TextBox in the Header or Footer and place a TextBox with this in it:

    To make it simple, check out the SampleDB I created and Posted/Attached here. And keep in mind it always easier to receive help if you can Post a sample on here. Check out the Form and the Report in DesignView to see how it all works. No need to created specific code just to sum totals. Just use a TextBox and keep it easier, in my viewpoint. Hope this helps and if not come back and will try again. OH, it's in Access2000 format.

    Attached Files Attached Files

Posting Permissions

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