Sub Forms

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

Guest

I have a Main form with a sub form and that sub form has a sub form. I can
total fields on each sub form but I can't get those totals to appear on th
emain form instantly or in real time. Any ideas?
 
Presumably you have something like this in the Control Source of a text box
in the Form Footer section of your sub-subform:
=Sum([Amount])
and then on the main form, you have something like:
=[Sub1].[Form].[Sub2].[Form].[Text3]

The sum updates not when you enter a value into a text box, but when the
record saves. At that point, Access processes any other data it needs (such
as fetching data for the next record) and runs any code (such as the Current
or AfterUpdate events of the form.) Once there is nothing else to do, it
gets around to recalculating the calculated controls (like those above), and
then finally updates the screen so you see the changes. If you have
conditional formatting that Access needs to update as well, there can be
further delays.

If you are trying to get the totals before the record is saved, forget it.

If you are trying to get the totals when the form's events run, you can try
forcing Access to update the calculated fields with:
Me.Recalc
Alternatively, you could read the totals directly from the subform's table
with a DSum() expression in the code that needs to have the fresh total.
 
Back
Top