Microsoft KB Archive/195946

= ACC: OpenDatabase Method does not Use Jet LoginTimeout Setting =

Article ID: 195946

Article Last Modified on 1/23/2007

-

APPLIES TO


 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q195946





IMPORTANT: This article contains information about editing the registry. Before you edit the registry, make sure you understand how to restore it if a problem occurs. For information about how to do this, view the "Restoring the Registry" Help topic in Regedit.exe or the "Restoring a Registry Key" Help topic in Regedt32.exe.

Moderate: Requires basic macro, coding, and interoperability skills.



SYMPTOMS
The default ODBC LoginTimeout property setting for Microsoft Jet databases is 20. Depending on which version of Microsoft Access you have, the ODBC LoginTimeout setting is stored in the following registry key.

In Microsoft Access 97

--

    HKEY_LOCAL_MACHINE\SOFTWARE Microsoft\Jet\3.5\Engines\ODBC\LoginTimeout

In Microsoft Access 7.0

---

    HKEY_LOCAL_MACHINE\SOFTWARE Microsoft\Jet\3.0\Engines\ODBC\LoginTimeout

You can change the ODBC LoginTimeout property value from the default of 20; however, the new value that you set will not be used in the OpenDatabase method of the current database, as in the following line:

  Set db=OpenDatabase("",false,false,"odbc;DSN=TEST" )



RESOLUTION
If you have changed the registry key to something other than the default of 20, and you want to use that new value with the OpenDatabase method, you should include the DBEngine object, as in the following line:

  set db=DBEngine.OpenDatabase("",false,false,"odbc;DSN=TEST" )



STATUS
Microsoft has confirmed this to be a problem in the versions of Microsoft Access listed at the beginning of this article.



Steps to Reproduce Problem
WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall your operating system. 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" Help topic in Registry Editor (Regedit.exe) or the "Add and Delete Information in the Registry" and "Edit Registry Data" Help topics in Regedt32.exe. Note that you should back up the registry before you edit it. If you are running Windows NT, you should also update your Emergency Repair Disk (ERD).

 Create an ODBC System DSN named TEST that points to some ODBC database. Open the ODBC tool in Control Panel and start ODBC tracing. Delete the current ODBC trace file if one exists.</li> Click Start, click Run, and then type Regedit in the Open box. Press ENTER.</li>  In Regedit change the following registry key to 50 with a Type of Decimal.

In Microsoft Access 97

--

<pre class="fixed_text">       HKEY_LOCAL_MACHINE\SOFTWARE Microsoft\Jet\3.5\Engines\ODBC\LoginTimeout

In Microsoft Access 7.0

---

<pre class="fixed_text">       HKEY_LOCAL_MACHINE\SOFTWARE Microsoft\Jet\3.0\Engines\ODBC\LoginTimeout </li> Open a Microsoft Access database and press CTRL+G to open the Debug Window.</li> Type the following line of code and press ENTER to run it: set db=DBEngine.OpenDatabase("",false,false,"odbc;DSN=TEST" )</li> Open the ODBC trace file in Microsoft Notepad and look for SQLSetConnectOption with the <LoginTimeout> value. Note that the DWORD value for <LoginTimeout> is 50. This indicates that Microsoft Jet is using the registry setting and calls SQLSetConnectOption with the LoginTimeout value of 50.</li> Close the database and delete the ODBC trace log.</li> Open another Microsoft Access database and run the following line of code from the Debug window: set db=OpenDatabase("",false,false,"odbc;DSN=TEST" ) Check the ODBC trace log again. Note that Jet does NOT use the registry setting and calls SQLSetConnectOption with the default LoginTimeout value of 20.</li></ol>

Keywords: kbbug kbnofix KB195946

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.