Total Subform columns

Twin

Registered User.
Local time
Today, 00:04
Joined
May 19, 2000
Messages
26
Hi Everybody,
I am trying to create a text box on the form that would show subtotal of the specific column on the subform above it. The subform is based on the query that runs each time a combo box is changed and it refreshes the subform. I have tried sourcing the text box as Sum([Query name],Column Name]), but that is returning #Error in the box.
Is it possible to make this work?
Thanx in advance
Chris
 
Hi Twin

Have you tried referencing the fields on your subform? Let me assume certain things.

You have a subform (frmInvoiceSub] with a text box called [txtCost](based on the query field [Cost], but named with prefix txt) on a main form called frmInvoice. Note that the field name and text box name are different (which Access does not automatically do - leave them the same and an error can occur as two objects have the same name).

On the main form you create an unbound text field called [txtTotal]. The control source for this references the subform (as an integral part of the main form). Therefore you will put the following as the control source:

=Sum(Me!frmInvoiceSub!txtCost)

or

=Sum(Me!frmInvoiceSub!Cost)

or

=Sum(frmInvoice!frmInvoiceSub!txtCost)

"Me" is used as a short name for the form (or report) currently open.

HTH

Rich
 

Users who are viewing this thread

Back
Top Bottom