>

QueryTimeout Property

Applies To

Database Object.

Description

Sets or returns a value that specifies the number of seconds the Microsoft Jet database engine waits before a timeout error occurs when a query is executed on an ODBC database.

Settings and Return Values

The setting or return value is an integer representing the number of seconds the Jet database engine waits before timing out and returning an error. The data type is Integer.

Remarks

When you're using an ODBC database, such as SQL Server, there may be delays due to network traffic or heavy use of the ODBC server. Rather than waiting indefinitely, you can specify how long to wait before the Jet database engine produces an error.

When used with a Database object, the QueryTimeout property specifies a global value for all queries associated with the database.

The timeout value is taken from the Windows Registry. If there is no Windows Registry setting, the default value is 60 seconds. Once this property is set, however, it overrides any Windows Registry setting or default value.

See Also

ODBCTimeout Property.

Example

This example opens the specified database and sets the QueryTimeout property to 120 seconds.


Dim dbsNorthwind As Database
Set dbsNorthwind =  DBEngine.Workspaces(0).OpenDatabase("Northwind.mdb")
dbsNorthwind.QueryTimeout = 120
Example (Microsoft Access)

The following example opens the specified database and sets the QueryTimeout property to 120 seconds.


Sub SetTimeout()
    Dim dbs As Database
    ' Return Database variable that points to current database.
    Set dbs = CurrentDb
    dbs.QueryTimeout = 120
End Sub