Question : Recalculate fields after requery.

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!
Kelly

Answer : Recalculate fields after requery.

I think tht you called it on this one.  I would set an on timer event, 3-5 sec should work from after the time you click on the submit button.  Also, if you are not storing the calculated filed from the main form, you can always set them to mirror. i.e.  

Me.txtMyCalcVal = [Forms]![frmYourSubFrm].[txtSubCalcVal]

TLH
Random Solutions  
 
programming4us programming4us