Total in a Text Box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form frmInvoice which also has a subform on it frmShipments. I can
add as many shipments as I like to the same invoice. Each shipment has an
extension text box with a specified amount. What I want to be able to do is
total these in a total text box within the frmInvoice. Can someone tell me
how to do this? Thank you in advance.

Jim
 
JJ said:
I have a form frmInvoice which also has a subform on it frmShipments. I can
add as many shipments as I like to the same invoice. Each shipment has an
extension text box with a specified amount. What I want to be able to do is
total these in a total text box within the frmInvoice. Can someone tell me
how to do this? Thank you in advance.

Add a footer to the subform and put a textbox in the footer. If the
extension text box is bound to a field called ExtendedPrice, the
controlsource for the new textbox wouyld be:

=Sum([ExtendedPrice])

Set the height of the new textbox to zero and name it txtTotal. Tuck it up
to the bottom of the detail section and collapse the footer so you can't see
it. Now add another text box to the main form and set its controlsource to:

=Forms!MainformName!SubformControlName.Form!tstTotal

The subformControlName is not necessarily the same name as the subform name,
so be careful there or you'll get a #Name error when you new textbox can't
find the subform. There is an example of this in the Orders form in the
Northwind sample database that came with Access.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Arvin, thank you very much for the quick response. That did the trick. I
actually forgot about the Northwind database and I am using a lot from that
now. Thanks again.

Arvin Meyer said:
JJ said:
I have a form frmInvoice which also has a subform on it frmShipments. I can
add as many shipments as I like to the same invoice. Each shipment has an
extension text box with a specified amount. What I want to be able to do is
total these in a total text box within the frmInvoice. Can someone tell me
how to do this? Thank you in advance.

Add a footer to the subform and put a textbox in the footer. If the
extension text box is bound to a field called ExtendedPrice, the
controlsource for the new textbox wouyld be:

=Sum([ExtendedPrice])

Set the height of the new textbox to zero and name it txtTotal. Tuck it up
to the bottom of the detail section and collapse the footer so you can't see
it. Now add another text box to the main form and set its controlsource to:

=Forms!MainformName!SubformControlName.Form!tstTotal

The subformControlName is not necessarily the same name as the subform name,
so be careful there or you'll get a #Name error when you new textbox can't
find the subform. There is an example of this in the Orders form in the
Northwind sample database that came with Access.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Back
Top