totalling fields in subform

G

Guest

I have one subform that has a cost for any number of publication records. The controlling link between these records is the Record ID which will be the same as the Main form's ID. I want to total the cost of these subform publications that have the same Record ID. Then I want to take that total from the subform and add it to the taxes and shipping charges on my main form. Right now I can't figure out how to even get the total on the subform. For instance. The subform fields are REcord ID (number field); Publication Title; and Publication Cost. Say I have 3 publications with the same Record ID number because on the main form this publication has the same Author. My subform shows "single records" at a time, it is not listed as a chart or table. Can anyone help me?
 
J

John Vinson

I have one subform that has a cost for any number of publication records. The controlling link between these records is the Record ID which will be the same as the Main form's ID. I want to total the cost of these subform publications that have the same Record ID. Then I want to take that total from the subform and add it to the taxes and shipping charges on my main form. Right now I can't figure out how to even get the total on the subform. For instance. The subform fields are REcord ID (number field); Publication Title; and Publication Cost. Say I have 3 publications with the same Record ID number because on the main form this publication has the same Author. My subform shows "single records" at a time, it is not listed as a chart or table. Can anyone help me?

You can use a Continuous Form; make its Form Footer visible and put a
textbox in the footer with a control source of

=Sum([Publication Cost])

Or, display the calculation on the mainform using a textbox summing
the results directly from the Table (remember, the data is stored in
the table, not in the form):

=DSum("[Publication Cost]", "[your-table-name]", "[Record ID] = " &
[Record ID])

It would be preferable NOT to store this sum in the table at all -
just calculate it as needed.
 

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