Total in a subform

I

Ivor Williams

I've a form with a subform which uses as a record source a query. In the
subform is a text box named txtWorkHours which uses as a control source a
calculated field in the query.

In the footer of the subform, I've added an unbound text box. In the Data
Control Source property for the text box, I entered the following:
=Sum([txtWorkHours]).
When I open the form, instead of getting a value, I get #Error.

Please explain.

Ivor
 
D

Dirk Goldgar

Ivor Williams said:
I've a form with a subform which uses as a record source a query. In the
subform is a text box named txtWorkHours which uses as a control source a
calculated field in the query.

In the footer of the subform, I've added an unbound text box. In the Data
Control Source property for the text box, I entered the following:
=Sum([txtWorkHours]).
When I open the form, instead of getting a value, I get #Error.

Please explain.


You can't Sum a text box, only a field from the form's recordsource. If,
for example, the calculate field in the query is named "WorkHours", then use
the expression:

=Sum([WorkHours])
 

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