ACC: How to Set the QueryTimeOut Value for ODBC Connections

Last reviewed: May 20, 1997
Article ID: Q153756
The information in this article applies to:
  • Microsoft Access versions 7.0, 97

SUMMARY

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 Datasources.

MORE INFORMATION

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.

Method 1

Create a subroutine to set the property:

  1. Create and run the following subroutine when you open your database:

          Sub SetTimeout()
            Dim Mydb as Database
            Set Mydb=CurrentDB
            MYdb.Querytimeout=120
          End Sub
    
    
Once this property is set, it overrides any Windows Registry setting or default value.

Method 2

Set the property in the Registry.

WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall Windows. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk.

For information about how to edit the registry, view the Changing Keys And Values online Help topic in Registry Editor (Regedit.exe). Note that you should make a backup copy of the registry files (System.dat and User.dat) before you edit the registry.

Using Microsoft Access 97

1. Go to the following registry key.

     HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\3.5\Engines\ODBC.

  • Select QueryTimeOut, click Edit and then modify. Change the DWORD value to your desired setting. The value represents the number of seconds to timeout.

    Using Microsoft Access version 7.0

    1. Create the following registry key.

          HKEY_LOCAL_MACHINE\Software\Microsoft\Access\7.0\Jet\3.0\Engines\ODBC
      

    2. Click Modify, and then select DWORD Value. Add QueryTimeOut and set the timeout to an integer value. This value will represent the number of seconds to timeout.

    REFERENCES

    For more information about backing up the system registry, please see the following article in the Microsoft Knowledge Base:

       ARTICLE-ID: Q135120
       TITLE     : Configuration Backup Tool for Backing Up the Registry
     
    
    	
    	

  • Keywords : kbusage OdbcHowto
    Version : 7.0 97
    Platform : WINDOWS
    Hardware : X86
    Issue type : kbhowto


    THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

    Last reviewed: May 20, 1997
    © 1998 Microsoft Corporation. All rights reserved. Terms of Use.