Updating/Refreshing Subform data

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

Guest

I have created a form (Main details) with 5 subforms (Visit1,
Visit2....Visit5). The subforms are only visible one at a time (5 tabs).
Subform Visit1 has a field (Date of visit) which is used to calculate
scheduled future date of visits in 4 other subforms(V2.....V5). I have
achieved this by creating 4 fields in Subform V1 (unbound calculated: Date of
visit+28, +56, +180 and +256). These dates are to be displayed on each
subform by refering to these in the subform1. I have achieved this by keeping
the subform Visit1 always open (hidden) with Main details form.
Once the Date of visit is entered in the Visit1 form, the dates correctly
displays on the other subforms BUT if for some reason Date of visit has to be
changed on the subform V1, the other 4 subforms do not update and keep on
showing the old dates. Is there a solution? Please help.

Thanks
 
Try and refresh the subforms on the after update event of the Date of visit

Me.Parent.v2.Requery
Me.Parent.v3.Requery
Me.Parent.v4.Requery
Me.Parent.v5.Requery
 
Many thanks Ofer. It worked.
In addition to your code, at the start I had to add the line Me.requery to
update the v1 otherwise it wouldn't work.
 
Back
Top