Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform total on Main form 1

Status
Not open for further replies.

webjunk

MIS
Dec 28, 1999
42
US
How can I total up the Sum of a subform on the Main form? The fields that is linked is the PONo. The subform is in continous view.

Thank You
 
Put a textbox on your subform in the footer.
Call it something like Total and put the =Sum([Fieldname]) in it's control source.
Then put a unbound text box on the main form.
Its control source will be the textbox on the subform.
Me![SubformName]!Total
After you have the formula working make the textbox on the subform invisible.


DougP, MCP
dposton@universal1.com

Ask me how Bar-codes can help you be more productive.
 
I do it a fair bit in A2K

The hypothetical situation is: On the sub-form each line has an amount & you want to show the sum of all line amounts on the main form.

1) On your sub-form create a sum control in the sub-form footer, like:

Name:[tab]SubFormTotal
Control Source: = Sum([Amount])
Visible:[tab]False

2) On the main form... create a control to reference the totaling control of the subform... err, that's the one you just created. Sooooooo

Name:[tab]ShowTotalFromSubform
Control Source: =[>>Insert Sub-Form Name<<].Form![SubFormTotal]

As long as you reference the full name of the sub-form's control you can perform any number of calulations on that &quot;Sum()&quot; from the sub-form. & it works for reports too.

i do something like... where i lifted the code

Sub-report:
Name: PAFSubReport

Sub-report's Control:
Name: DocTot
Control Source: =Sum([Amount])

Main report's control: 'shows one month of salary
Control Source: =IIf([PAFLayout]=&quot;A&quot;,[PAFSubReport].Report![DocTot]/12)

hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top