A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Running Total from a Subform



 
 
Thread Tools Display Modes
  #1  
Old May 12th, 2010, 03:46 PM posted to microsoft.public.access.forms
NFL
external usenet poster
 
Posts: 74
Default 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  
Old May 12th, 2010, 04:24 PM posted to microsoft.public.access.forms
BruceM via AccessMonster.com
external usenet poster
 
Posts: 448
Default 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  
Old May 12th, 2010, 05:58 PM posted to microsoft.public.access.forms
NFL
external usenet poster
 
Posts: 74
Default 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  
Old May 12th, 2010, 07:01 PM posted to microsoft.public.access.forms
BruceM via AccessMonster.com
external usenet poster
 
Posts: 448
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.