ACC: How to Set the QueryTimeout Value for ODBC ConnectionsID: Q153756
|
IMPORTANT: This article contains information about editing the registry.
Before you edit the registry, you should first make a backup copy of the
registry files (System.dat and User.dat). Both are hidden files in the
Windows folder.
Advanced: Requires expert coding, interoperability, and multiuser skills.
This article demonstrates how to set the QueryTimeout property for queries
run against ODBC data sources.
When you're using an ODBC database, such as Microsoft SQL Server, there may
be delays because of network traffic or heavy use of the ODBC server.
Rather than waiting indefinitely, you can specify how long to wait before
the Microsoft Jet database engine produces an error. The default
QueryTimeout property setting is 60 seconds. This setting may not be long
enough to allow some queries to run against ODBC data sources. The
following two methods demonstrate how to change the QueryTimeout property.
NOTE: When using Method 1 to change the QueryTimeout property, the value
will be set for a specific QueryDef object. When you create a new query
through the user interface within Microsoft Access 97, the QueryTimeout
property will default to 60.
NOTE: When using the steps contained within Method 2 to set the
QueryTimeout value within the registry, any new and existing query within
Microsoft Access will continue to display a value of 60 for the
QueryTimeout property. If the value set within the registry is greater
than the value defined within the individual query, Microsoft Access will
use the value within the registry to determine how long to wait before a
QueryTimeout occurs.
Sub SetTimeout()
Dim Mydb as Database
Set Mydb=CurrentDB
MYdb.QueryTimeout=120
End Sub
Sub mytest()
Dim mydb As Database
Set mydb = DBEngine(0)(0)
mydb.QueryTimeout = 120
MsgBox mydb.QueryTimeout
End Sub
HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\3.5\Engines\ODBC
HKEY_LOCAL_MACHINE\Software\Microsoft\Access\7.0\Jet\3.0\Engines\ODBC
For more information about backing up the system registry, please see the
following article in the Microsoft Knowledge Base:
Q135120 Configuration Backup Tool for Backing Up the Registry
Keywords : kbusage OdbcHowto
Version : 7.0 97
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: April 16, 1999