ReCalc or Refresh?

  • Thread starter Thread starter Scott
  • Start date Start date
S

Scott

If I have a calculated control that gets data from 2 other controls that a
user enters, is there a method to refresh the calculated control?
 
Me.Refresh should do the job. In some circumstances
Me.Requery may be required.

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
Scott said:
If I have a calculated control that gets data from 2 other controls
that a user enters, is there a method to refresh the calculated
control?

Are you sure you need to? Often there is no need to explicitly
recalculate a calculated control. If you do need to, executing the VBA
statement

Me.Recalc

from inside the form's code module will be the least intrusive method.
Me.Refresh will cause the current record to be saved (if dirty) and
updated records to be reloaded from the form's recordsource, while
Me.Requery will cause the current record to be saved (if dirty) and run
the form's recordsource query all over again (possibly changing the set
of records that is returned).
 
Nice explanation. I have probably refreshed many times when
the Recalc would have been sufficient.

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
Gary Miller said:
Nice explanation. I have probably refreshed many times when
the Recalc would have been sufficient.

Thanks. I just realized, though, that Me.Recalc also causes the current
record to be saved, if it is dirty. So my explanation was incomplete.
 
Back
Top