Running Total from a Subform

  • Thread starter Thread starter NFL
  • Start date Start date
N

NFL

I have a unbound control box (called textbox 20) in the details section on my
subform that calculates unit price and units orders. The data source looks
like this ...=[UnitPrice]*[UnitsOrdered]

I want to get a running total set up on my main form. Before I do that I'm
pretty sure I need to set up my header on the subform. In my subform, I
entered another unbound textbox (called textbox 26) on the header with a
datasource that looks like this =sum([textbox20]).

Both of these control boxes are set to currency and when I try to preview
the form, my header gives me a #Error.

Thank you for your help!
 
That worked! I repeated the calculation. Thank you and please pass my
thanks to the Database Team for all their help!

BruceM via AccessMonster.com said:
You need to repeat the calculation, not reference the calculated control.
TextBox26 would need to be:
=Sum([UnitPrice]*[UnitsOrdered])

If you perform the UnitPrice*UnitsOrdered calculation in the subform's record
source query you can use Sum on the calculated field, but as you have
described it you need to sum the calculation as shown.

You can reference the text box from the main form by using the following as
the Control Source of an unbound text box on the main form:

=Forms!MainFormName!SubformControlName.Form!TextBox26

Actually, you should be able to use a shorter version of the expression:

=SubformControlName.Form!TextBox26
I have a unbound control box (called textbox 20) in the details section on my
subform that calculates unit price and units orders. The data source looks
like this ...=[UnitPrice]*[UnitsOrdered]

I want to get a running total set up on my main form. Before I do that I'm
pretty sure I need to set up my header on the subform. In my subform, I
entered another unbound textbox (called textbox 26) on the header with a
datasource that looks like this =sum([textbox20]).

Both of these control boxes are set to currency and when I try to preview
the form, my header gives me a #Error.

Thank you for your help!

--
Message posted via AccessMonster.com


.
 
Back
Top