ACC2000: OpenDatabase Method Does Not Use Jet LoginTimeout (202037)



The information in this article applies to:

  • Microsoft Access 2000

This article was previously published under Q202037
This article applies only to a Microsoft Access database (.mdb).

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 key:

HKEY_LOCAL_MACHINE\SOFTWAREMicrosoft\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. In Control Panel, click the ODBC icon and start ODBC tracing.
  3. Delete the current ODBC trace file if one exists.
  4. Click Start, click Run, type regedit in the Open box, and then click OK.
  5. In Registry Editor, change the following registry key to 50 with a type of Decimal:

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

  6. Open a Microsoft Access database and press CTRL+G.
  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 the Microsoft Jet database engine 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 and run the following line of code from the Immediate window:
    Set db=opendatabase("",false,false,"odbc;DSN=TEST" )
    					
Checking ODBC trace, note that the Jet database engine does NOT use the registry setting and calls SQLSetConnectOption with the default LoginTimeout value of 20.

Modification Type:MajorLast Reviewed:6/24/2004
Keywords:kbbug kbnofix KB202037