ACC2000: OpenDatabase Method Doesn't Use the Jet LoginTimeout (199829)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q199829
Moderate: Requires basic macro, coding, and interoperability skills.

IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry

SYMPTOMS

The default ODBC Login timeout setting for Microsoft Jet databases is 20 and is stored, depending on the version, in the following registry keys:

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

You can change this value from the default of 20; however, the new value 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 that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

Steps to Reproduce Problem

  1. Create an ODBC System DSN named TEST that points to some ODBC database.
  2. Open the ODBC tool in Control Panel and start ODBC tracing.
  3. Delete the current ODBC trace file if one exists.
  4. Click Start, click Run, type Regedit, and then press ENTER.
  5. In the Registry Editor, change the following registry key to 50 with a type of Decimal:

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

  6. Open a Microsoft Access database, and press CTRL+G to open the Immediate window.
  7. Type the following line of code in the Immediate window, and then press ENTER:
    Set db=DBEngine.OpenDatabase("",false,false,"odbc;DSN=TEST" )
    					
  8. 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.
  9. Close the database and delete the ODBC trace log.
  10. Open another Microsoft Access database, type the following line in the Immediate window, and then press ENTER:

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

    Note that when you check ODBC trace, you see that Jet does NOT use the registry setting and calls SQLSetConnectOption with the default LoginTimeout value of 20.

Modification Type:MajorLast Reviewed:6/30/2004
Keywords:kbbug kbfix KB199829