Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The Requery method of the DoCmd object carries out the Requery action in Visual Basic.
expression.Requery(ControlName)
expression Required. An expression that returns one of the above objects.
ControlName Optional Variant. A string expression that's the name of a control on the active object.
The Requery method updates the data underlying a specified form or a control that's on the active form by requerying the source of data for the form or control.
expression.Requery
expression Required. An expression that returns one of the objects in the Applies To list.
You can use this method to ensure that a form or control displays the most recent data.
The Requery method does one of the following:
Controls based on a query or table include:
If you specify any other type of control for the object specified by expression, the record source for the form is requeried.
If the object specified by expression isn't bound to a field in a table or query, the Requery method forces a recalculation of the control.
If you omit the object specified by expression, the Requery method requeries the underlying data source for the form or control that has the focus. If the control that has the focus has a record source or row source, it will be requeried; otherwise, the control's data will simply be refreshed.
If a subform control has the focus, this method only requeries the record source for the subform, not the parent form.
Notes
The following example uses the Requery method to update the EmployeeList control:
DoCmd.Requery "EmployeeList"
The following example uses the Requery method to requery the data from the EmployeeList list box on an Employees form:
Public Sub RequeryList()
Dim ctlCombo As Control
' Return Control object pointing to a combo box.
Set ctlCombo = Forms!Employees!ReportsTo
' Requery source of data for list box.
ctlCombo.Requery
End Sub
Applies to | BoundObjectFrame Object | CheckBox Object | ComboBox Object | CommandButton Object | Control Object | CustomControl Object | DoCmd Object | Form Object | Image Object | ListBox Object | ObjectFrame Object | OptionButton Object | OptionGroup Object | Page Object | SubForm Object | TextBox Object | ToggleButton Object
See Also | Recalc Method | Refresh Method | Repaint Method | RepaintObject, ShowAllRecords, Requery, and Refresh Action/Method Comparison | Requery Method
Please sign in to use this experience.
Sign in