Requery Method (DoCmd Object)

Applies To

DoCmd Object.

Description

The Requery method of the DoCmd object carries out the Requery action in Visual Basic. For more information on how the action and its argument work, see the action topic.

Syntax

DoCmd.Requery [controlname]

The Requery method uses the following arguments.

Argument

Description

controlname

A string expression that is the name of a control on the active object


Remarks

Use only the name of the control for the controlname argument, not the full syntax.

You can also use a variable declared as a Control data type for this argument:


Dim LstBox As ControlLstBox = Forms!Form1!Field3.Requery LstBox.Name

The Requery method of the DoCmd object is different from the Requery method in Visual Basic. The Requery method of the DoCmd object was added to provide backwards compatibility for running the Requery action in Visual Basic code in Microsoft Access for Windows 95. If you want to requery a control that is not 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 Requery method for DAO objects works the same way as the Microsoft Access Requery method.

Example

This example uses the Requery method to update the EmployeeList control.


DoCmd.Requery "EmployeeList"