Recalculate fields after requery.
Posted on 2010-08-27
I have a form with a subform and calculated field. When the form opens the subform has no control source. There is a field on the main form where the user enters a date and clicks "Submit".
The following events then take place:
Subform control source is set to a query.
Main form date is passed to subform/query and records are returned.
One subform field sums up a field from all records (this was in the footer of subform, now in main section of subform).
Control Source gets set for calculated field on main form (see below).
The calculated field on the main form is linked to the subform field that totals up all records. I just want to show the total on the main form. I should note that the calculated field on the main form is unbound upon opening the form, but the control source gets set after the control source is set for the subform.
Issue: The calculated field on the main form is blank after clicking "Submit" and after records are returned. I'm pretty sure this is a timing issue because I have a button that just calculates the total on the main form (when there are subform records present) and it pops up with no problems.
How do I get this field to be calculated after the subform returns all records?
Thanks in advance!