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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform Sum

Status
Not open for further replies.

Costefran

Technical User
Jan 2, 2008
197
GB
Can anyone help with my subform sum which is driving me to despair

I have a subform sourced from a table where one of the controls is called 'Total Line Cost'. Both the table and the form are set to currency format

I have added an unbound control to the subform footer called 'Sum of Total line cost' with the record source as follows

=Sum([Total Line Cost])

I keep getting an 'error' on the unbound control

Please note 'Total Line Cost' is not a calculated control and sourced direct from the underlying table

Any help would be great

Thanks
 
What is the exact error text?

Are you sure the field name is not the name of the control where the sum is happening?
 
Thanks for the response

The message that is being shown in the control is '#Error'

The name of the control in the detail of the continuous subform is
'this Invoice Cost' and its controsource
is 'Cost Auth this Invoice Cost'

The name of the control in the form footer is
'Sum of this Invoice Cost' and its control source is
'=Sum([this Invoice Cost])

If it helps the main form has 2 continuous subforms. I thought that this may affect the result?

Thanks
 
How are ya Costefran . . .

Not enough info yet, but try:
Code:
[blue]=Sum([purple][b]Nz([/b][/purple][Total Line Cost],0[purple][b])[/b][/purple])[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
I agree with Aceman, we don't have enough information as it seems as though it should be working if I understand everything.

Aceman's suggestion is intersting but I'm not sure he followed your control sources correctly. Honestly I'm not sure I did either so go ahead and try it.

More generically you want to sum the control source of a control (not the the control itself). In this case replace <Control Source You want Summed> with the one field control source you want. If you were to use multiple fields, you would of course use the square brackets around the individual fiels and not the whole control source.

Code:
=Sum(Nz([<Control Source You want Summed>],0))

Other guesses...
Are you sure the field you are trying to sum has a numeric datatype? Is the field comming direct from a table? Have you tried a compact and repair? Does #Error appear in any row in your table (unfortunately you will most likely have to delete and reenter in order to fix it)?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top