Totaling 2 subforms on a form

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

Guest

I have a form that has 2 subforms on it. each subform has a separate total.
How do I display on the form the "grand total"

Thanks,
 
You could try placing a text box in the part of the form where you want the
Grand total to appear and leave it empty. Call it txtGrandTotal (for example)

One of the events in the forms properties needs to trigger the Grand total.
Let's say for arguments sake it's the OnOpen event:

Private Sub Form_Open(Cancel As Integer)

txtGrandTotal = Forms!Subform1!Field1 + Forms!Subform2!Field1

End Sub

This will generate the total everytime and populate the required field. You
may have to try OnCurrent also to see which one is most effective. Try iy!!

Daz
 
Daz,
Thanks for your help.
I did what you suggested, and I am getting a #Name? error
What's this? does this mean i miss spelled one of the total names?
Thanks, Ofer
 
Yeah - normally this refers to the names referenced in the code. Try adding
the [] brackets below. This should work but like I say it may need to be
generated by another event. Alternatively, try entering the right hand side
of the entry below in the Control Source of the text box where you want your
total to appear (remembering the = sign!!)

[txtGrandTotal] = Forms![Subform1]![Field1] + Forms![Subform2]![Field1]
 

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

Similar Threads


Back
Top