Applies To Connection object, Database object.
Description
Sets or returns a value that specifies the number of seconds to wait before a timeout error occurs when a query is executed on an ODBC data source.
Settings and Return Values The setting or return value is an Integer representing the number of seconds to wait. The default value is 60. Remarks When you're using an ODBC database, such as Microsoft 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. When you use QueryTimeout with a Connection or Database object, it specifies a global value for all queries associated with the database. You can override this value for a specific query by setting the ODBCTimeout property of the particular QueryDef object. In a Microsoft Jet workspace, you can override the default value by creating a new "ODBC" key in the Registry path \HKEY_LOCAL_MACHINE\SOFTWARESee Also ODBCTimeout property.
Example See the ODBCTimeout property example. Example (Microsoft Access) The following example sets the QueryTimeout property of the current database:Sub SetTimeout()
Dim dbs As Database
' Return reference to current database.
Set dbs = CurrentDb
dbs.QueryTimeout = 120
Set dbs = Nothing
End Sub