Adding detail textboxes in access reports

Hi, im having a problem adding values of a textbox on an access report. I have a textbox with an equation of sorts in my detail, and i would like to add all the detail values to get a total in the footer. Normally i would use =Sum(FIELD)but because i am trying to add the value of the actual text box and not a field it doesn't like that!

Thanks
Scott

Comments

  • I don't think it is possible.
    The only solution I can think of is to make an independent field on your report and assign it some code like below. As long as you don't run it over a slow network and a few times a day, it shouldn't be too slow...
    [code]
    Sub Report_Open()
    Dim rst As RecordSet
    Dim textfield as String
    Set rst = CurrentDb.OpenRecordSet("Equations")
    rst.MoveFirst
    Do Until rst.EOF
    textfield = textfield & rst.Fields(0)
    rst.MoveNext
    Loop
    rst.Close
    ' I assume you're on the Report, so I used Me. here
    Me.MyIndependentTextField = textfield
    [/code]

    : Hi, im having a problem adding values of a textbox on an access report. I have a textbox with an equation of sorts in my detail, and i would like to add all the detail values to get a total in the footer. Normally i would use =Sum(FIELD)but because i am trying to add the value of the actual text box and not a field it doesn't like that!
    :
    : Thanks
    : Scott
    :

  • Here's a thought. If you can, put the equation in your recordsource, so that your "equation of sorts" comes out as a field, already calculated. Then you can use the SUM function in your footer and it should work.


    : I don't think it is possible.
    : The only solution I can think of is to make an independent field on your report and assign it some code like below. As long as you don't run it over a slow network and a few times a day, it shouldn't be too slow...
    : [code]
    : Sub Report_Open()
    : Dim rst As RecordSet
    : Dim textfield as String
    : Set rst = CurrentDb.OpenRecordSet("Equations")
    : rst.MoveFirst
    : Do Until rst.EOF
    : textfield = textfield & rst.Fields(0)
    : rst.MoveNext
    : Loop
    : rst.Close
    : ' I assume you're on the Report, so I used Me. here
    : Me.MyIndependentTextField = textfield
    : [/code]
    :
    : : Hi, im having a problem adding values of a textbox on an access report. I have a textbox with an equation of sorts in my detail, and i would like to add all the detail values to get a total in the footer. Normally i would use =Sum(FIELD)but because i am trying to add the value of the actual text box and not a field it doesn't like that!
    : :
    : : Thanks
    : : Scott
    : :
    :
    :

  • Good idea. You can have a field in the reports query like 'EOS: EOS([ANumber])', where ANumber is the field that you perform EOS on (of course you can pass as many fields as you need) and EOS is a public function in acode module. So you can [italic]always[/italic] have the result of [b]any[/b] equation/function as a column in a query.

    : Here's a thought. If you can, put the equation in your recordsource, so that your "equation of sorts" comes out as a field, already calculated. Then you can use the SUM function in your footer and it should work.
    :
    :
    : : I don't think it is possible.
    : : The only solution I can think of is to make an independent field on your report and assign it some code like below. As long as you don't run it over a slow network and a few times a day, it shouldn't be too slow...
    : : [code]
    : : Sub Report_Open()
    : : Dim rst As RecordSet
    : : Dim textfield as String
    : : Set rst = CurrentDb.OpenRecordSet("Equations")
    : : rst.MoveFirst
    : : Do Until rst.EOF
    : : textfield = textfield & rst.Fields(0)
    : : rst.MoveNext
    : : Loop
    : : rst.Close
    : : ' I assume you're on the Report, so I used Me. here
    : : Me.MyIndependentTextField = textfield
    : : [/code]
    : :
    : : : Hi, im having a problem adding values of a textbox on an access report. I have a textbox with an equation of sorts in my detail, and i would like to add all the detail values to get a total in the footer. Normally i would use =Sum(FIELD)but because i am trying to add the value of the actual text box and not a field it doesn't like that!
    : : :
    : : : Thanks
    : : : Scott
    : : :
    : :
    : :
    :
    :
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories