Requery Action

Description

You can use the Requery action to update the data in a specified control on the active object by requerying the source of the control. If no control is specified, this action requeries the source of the object itself. Use this action to ensure that the active object or one of its controls displays the most current data.

Setting

The Requery action has the following argument.

Action argument

Description

Control Name

The name of the control you want to update. Enter the control name in the Control Name box in the Action Arguments section of the Macro window. You should use only the name of the control, not the fully qualified identifier (such as Forms!formname!controlname). Leave this argument blank to requery the source of the active object. If the active object is a datasheet or a query result set, you must leave this argument blank.


Remarks

The Requery action does one of the following:

  • Reruns the query on which the control or object is based.
  • Displays any new or changed records, and removes any deleted records from the table on which the control or object is based.
Controls based on a query or table include:

  • List boxes and combo boxes.
  • Subform controls.
  • OLE objects, such as charts.
  • Controls containing domain aggregate functions, such as DSum.
If the specified control isn't based on a query or table, this action forces a recalculation of the control.

If you leave the Control Name argument blank, the Requery action has the same effect as pressing SHIFT+F9 when the object has the focus. If a subform control has the focus, this action requeries only the source of the subform (just as pressing SHIFT+F9 does).

Note The Requery action requeries the source of the control or object. In contrast, the RepaintObject action repaints controls in the specified object but doesn't requery the database or display new records. The ShowAllRecords action not only requeries the active object, but it also removes any applied filters, which the Requery action doesn't do.

If you want to requery a control that isn't on the active object, you must use the Requery method in Visual Basic, not the Requery action or its corresponding Requery method of the DoCmd object. The Requery method in Visual Basic is faster than the Requery action or the DoCmd.Requery method. In addition, when you use the Requery action or the DoCmd.Requery method, Microsoft Access closes the query and reloads it from the database, but when you use the Requery method, Microsoft Access reruns the query without closing and reloading it. Note that the DAO Requery method works the same way as the Microsoft Access Requery method.

See Also

RepaintObject action, Requery method (Control or Form object), Requery method ("DAO Language Reference"), Requery method (DoCmd object), ShowAllRecords action.