Running Total from a Subform

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!
 
B

BruceM via AccessMonster.com

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!
 
N

NFL

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!

--



.
 
B

BruceM via AccessMonster.com

Glad it worked. I do want to point out that this is a volunteer newsgroup.
I am not part of a team, but rather somebody who checks in on the newsgroups
to ask questions, learn new things by browsing threads, and repay the
assistance I have received by contributing responses as I am able.
That worked! I repeated the calculation. Thank you and please pass my
thanks to the Database Team for all their help!
You need to repeat the calculation, not reference the calculated control.
TextBox26 would need to be:
[quoted text clipped - 26 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top