Sum of unbound controls

G

Guest

I need to calculate the sum of values entered by the user in a subform. the
record source for the subform returns 1 field, [Type]. I have added an
umbound control "Penalty" in which the user enters a number for each record
in the subform recordset. In the footer of the subform I have an unbound
control which uses the function/operator =Sum([Penalty]) as the control
source but that causes "Error" to appear in the control rather than the sum.
I think the problem is that Sum() only reconizes bound controls. Is there a
way to sum unbound fields when the number of occurances to be summed varies??

One alternative is to include a bound field in the query used for the
subform record source but when I do that I have to run an update query to
remove the entered values from the source table. I do no need, nor want, to
retain the values entered by the user, just the sum.

any help is appreciated
 
M

Marshall Barton

Steve said:
I need to calculate the sum of values entered by the user in a subform. the
record source for the subform returns 1 field, [Type]. I have added an
umbound control "Penalty" in which the user enters a number for each record
in the subform recordset. In the footer of the subform I have an unbound
control which uses the function/operator =Sum([Penalty]) as the control
source but that causes "Error" to appear in the control rather than the sum.
I think the problem is that Sum() only reconizes bound controls. Is there a
way to sum unbound fields when the number of occurances to be summed varies??

One alternative is to include a bound field in the query used for the
subform record source but when I do that I have to run an update query to
remove the entered values from the source table. I do no need, nor want, to
retain the values entered by the user, just the sum.


There is some kind of misunderstanding here. An unbound
control only has one value so you can not be entering a
value for each record.

Besides, how do you expect to save these values if the
Penality text box is not bound?

FYI: The aggregate functions (Count, Sum, etc) only
recognize **fields** in a form/report's record source
table/query. They are unaware of controls.
 

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