>

Idle Method

Applies To

DBEngine Object.

Description

Suspends data processing, enabling the Microsoft Jet database engine to complete any pending tasks such as memory optimization or page timeouts.

Syntax

DBEngine.Idle [dbFreeLocks]

Remarks

You use the Idle method to provide the Jet database engine with the opportunity to perform background tasks that may not be up-to-date because of intense data processing. This is often true in multiuser, multitasking environments in which there isn't enough background processing time to keep all records in a recordset current.

Usually, read locks are removed and data in local dynaset-type Recordset objects is updated only when no other actions (including mouse movements) are occurring. If you periodically use the Idle method, you provide the database engine with time to catch up on background processing tasks by releasing unneeded read locks. If you specify the dbFreeLocks constant as an argument, processing is delayed until all read locks are released.

This method isn't needed in single-user environments unless multiple instances of an application are running. The Idle method may increase performance in a multiuser environment because it forces the database engine to flush data to disk, releasing locks on memory.

You can also release read locks by making operations part of a transaction. For example:


wspSession.BeginTrans
Set rstEmployees = rstEmployees.OpenRecordset("Employees")
wspSession.CommitTrans


Do Until rstEmployees.EOF
    ...
    ...
    ...
    rstEmployees.MoveNext
Loop