Requery forms

  • Thread starter Thread starter judith
  • Start date Start date
J

judith

What is the best way to refresh a screen when data has
changed. I have two sub forms, one showing items that
have been completed and the other showing items
remaining. As I tick a box the record moves from one
subform to the other. I am using a requery command which
works but is rather slow.

DoCmd.Save
Forms!systemForm!maintenanceNoVisitLogForm.SetFocus
DoCmd.Requery

Any suggestions please.
 
judith said:
What is the best way to refresh a screen when data has
changed. I have two sub forms, one showing items that
have been completed and the other showing items
remaining. As I tick a box the record moves from one
subform to the other. I am using a requery command which
works but is rather slow.

DoCmd.Save
Forms!systemForm!maintenanceNoVisitLogForm.SetFocus
DoCmd.Requery


I'm suprised that this works at all. The Save method does
not save the changes to a record, it saves the design of an
object (form, report, etc). If you must use DoCmd then use
the RunCommand acCmdSaveRecord method. A better way to save
the current record is:

If Me.Dirty Then Me.Dirty = False

Next, you can skip the set focus if you requery the form
objct directly:

Parent.maintenanceNoVisitLogForm.Form.Requery

Those two lines may not make it run faster, but at least
they're reliable.

The overall speed of the operation is highly dependent on
the complexity of the other subfoprm's record source
table/query, the base table's indexes and the number of
records involved.
 
Back
Top