Bring a subtotal from subform to main form

  • Thread starter Thread starter Lisa
  • Start date Start date
L

Lisa

Hi

Let me start with I've very new at Access and am trying
to set up a database....anyway
I'm trying to bring the subtotal from my subform to my
main form. I know this is in the Northwind database and
I've tried following this but I keep coming back with
either an #Error or #Name message.

Please help me its driving me insane

Thanks
Lisa
 
Hi

Let me start with I've very new at Access and am trying
to set up a database....anyway
I'm trying to bring the subtotal from my subform to my
main form. I know this is in the Northwind database and
I've tried following this but I keep coming back with
either an #Error or #Name message.

To display the subtotal on the mainform you need two textboxes:

- on the Form Footer section (*not* the detail section, you'll need to
use the View menu option and check "form header and footer") of the
subform put a textbox with a control source

=Sum([fieldname])

Let's say you name this txtSubtotal, and that the subform is displayed
within a Subform control named subMySub. (Note that the name of the
*form* within that subform control is irrelvant! It's the Name
property of the "box" containing the form that you need).

- On the mainform put a textbox with a control source

=sbuMySub.Form!txtSubtotal

to "relay" the value.

If you're trying to store the subtotal in the main form's table...
don't. It's derived data and should almost always be recalculated
rather than stored.
 
Back
Top