Requery macro action
Applies to: Access 2013, Office 2013
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.
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 Builder pane. 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. |
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.
Note
The Requery action does not affect the position of the record pointer.
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 a Visual Basic for Applications (VBA) module, not the Requery action or its corresponding Requery method of the DoCmd object. The Requery method in VBA 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, Access reruns the query without closing and reloading it. Note that the ActiveX Data object (ADO) Requery method works the same way as the Access Requery method.