ACC2: ODBCTimeout Set to Zero for New Pass-Through Queries

Last reviewed: May 14, 1997
Article ID: Q117537
The information in this article applies to:
  • Microsoft Access version 2.0

SYMPTOMS

Advanced: Requires expert coding, interoperability, and multiuser skills.

When you create a SQL pass-through query using Access Basic, the ODBCTimeout property setting for the query is set to zero, despite the timeout setting you specify.

RESOLUTION

When you use Access Basic to create a SQL pass-through query, set the ODBCTimeout property after you set the Connect property for the query. If you do not do this, the ODBCTimeout property is set to zero.

STATUS

Microsoft has confirmed this to be a problem in Microsoft Access version 2.0. This problem no longer occurs in Microsoft Access version 7.0.

MORE INFORMATION

The ODBCTimeout property setting specifies the number of seconds Microsoft Access waits before a timeout error occurs on a query involving an ODBC database. When this property is set to zero, no timeout occurs.

Steps to Reproduce Problem

NOTE: This example assumes that you have an ODBC data source (such as Microsoft SQL Server) available.

  1. Open the sample database NWIND.MDB.

  2. Create a new module and enter the following sample procedure:

          Sub CreateSPTQuery()
             Dim db As Database, q As QueryDef
             Set db = dbengine(0)(0)
             'Create a new QueryDef.
             Set q = db.CreateQueryDef()
             q.Name = "MySPTQuery"
             'Modify the line below to select from an existing ODBC table.
             q.SQL = "Select * From authors;"
             q.ODBCTimeout = 60
             q.Connect = "ODBC;"
             q.ReturnsRecords = True
             'Add the QueryDef to the QueryDefs collection.
             db.QueryDefs.Append q
             db.QueryDefs.Refresh
             'Print the ODBCTimeout setting to the Immediate window.
             Debug.Print db.QueryDefs("MySPTQuery").ODBCTimeout
          End Sub
    
    

  3. In the Immediate window, test this procedure by typing:

          CreateSPTQuery
    

Microsoft Access will print a zero (0) to indicate the ODBCTimeout setting for the query.

REFERENCES

Microsoft Access "User's Guide," version 2.0, Chapter 12, "Advanced Queries," pages 291-294


Additional query words: spt passthrough jet25 jet 2.5
Keywords : kbusage QryPass
Version : 2.0
Platform : WINDOWS
Hardware : X86
Issue type : kbbug
Resolution Type : kbworkaround


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 14, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.