Update calculated field in form based on subform

C

Craig

Hello,

I have a form (frmRentals) that contains a subform (sfrmTransactions).

sfrmTransactions is based on a table (tblTransactions) which contains all
the transactions for the rental that is shown on the main form.

frmRentals is based on a query (qryRentals) that contains a calculated field
(totalPaid). totalPaid is the sum of all transactions for the rental (which
are shown in sfrmTransactions).

As I enter more transactions into sfrmTransactions, however, the calculated
field (totalPaid) does not update. I have to close the form and reopen to
see the newly calculated total.

What event or code do I need to implement to make this happen? Ideally, I
would like the totalPaid field to update as soon as I enter a new record into
sfrmTransactions/tblTransactions.

I know that this should be relatively simple --- I just can't figure it out!

Thanks,

Craig
 
K

Klatuu

There is a better way to do it.
Turn on Headers and Footers in your subform. Add a text box to the footer
and use a Sum function as the control source:
=Sum([TransactionAmount])

The header and footer will not show for a subform.

Now on the main form make the control source of the text box where you want
to show that amount:

=Forms!MainFormName!SubformName.Form.ControlName

Use your actual object names, of course.
 

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