If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Running Total from a Subform
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! |
#2
|
|||
|
|||
Running Total from a Subform
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!TextBo x26 Actually, you should be able to use a shorter version of the expression: =SubformControlName.Form!TextBox26 NFL wrote: 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 http://www.accessmonster.com/Uwe/For...forms/201005/1 |
#3
|
|||
|
|||
Running Total from a Subform
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" wrote: 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!TextBo x26 Actually, you should be able to use a shorter version of the expression: =SubformControlName.Form!TextBox26 NFL wrote: 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 http://www.accessmonster.com/Uwe/For...forms/201005/1 . |
#4
|
|||
|
|||
Running Total from a Subform
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. NFL wrote: 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] Thank you for your help! -- Message posted via http://www.accessmonster.com |
Thread Tools | |
Display Modes | |
|
|