Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > Access Modules daovba ado > How to set the ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 1450 of 1609
Post > Topic >>

How to set the ODBCtimeout property in code

by =?Utf-8?B?TGlzYWI=?= <Lisab@[EMAIL PROTECTED] > Apr 2, 2008 at 09:00 AM

Can I set the ODBCtimeout property in code (don't want to fool around with 
the Registry settings) 
-----------------------
I have code that loops through each table in my database and gets the
number 
of records in each table.  It outputs the table name and number of records
to 
another table.

Some tables have over 1 million records and so I get an ODBC failed error 
because the ODBC connection has timed out.

IS there a way to set the timeout property in my code?  the following line

is where I get the timeout error

                  Set SourceRS = dbs.OpenRecordset(sqlStatement)

---------------------
Dim MyRecordCount As Double
    With rsRecordCount
        For Each tdf In dbs.TableDefs
            'If the table name is a tem****ary or system table then ignore
it
            If Left(tdf.Name, 1) = "~" Or _
            Left(tdf.Name, 4) = "MSYS" Or _
            Left(tdf.Name, 3) = "tbl" Then
                '~ indicates a tem****ary table
                'MSYS indicates a system level table
                'local table I don't want to include in the count
            Else 'only process application Tables
                'update tblTableRecordCounts with the tablename and record

count
                sqlStatement = "SELECT Count(*) AS MyCount FROM " &
tdf.Name 
& ";"
                tdf.ODBCTimeout.Value = 0
                Set SourceRS = dbs.OpenRecordset(sqlStatement)  '***ERROR 
HERE**
                With rsRecordCount
                  .AddNew
                  !TableName = tdf.Name
                  !TotalRecords = SourceRS!MyCount
                  .Update
                End With
            End If
        Next tdf
    End With
    Set dbs = Nothing
    rsRecordCount.Close
    SourceRS.Close
 




 6 Posts in Topic:
How to set the ODBCtimeout property in code
=?Utf-8?B?TGlzYWI=?= <  2008-04-02 09:00:02 
Re: How to set the ODBCtimeout property in code
"Alex Dybenko"   2008-04-03 15:32:45 
Re: How to set the ODBCtimeout property in code
"david" <dav  2008-04-04 17:03:07 
Re: How to set the ODBCtimeout property in code
=?Utf-8?B?TGlzYWI=?= <  2008-04-04 09:46:01 
Re: How to set the ODBCtimeout property in code
=?Utf-8?B?TGlzYWI=?= <  2008-04-04 09:52:02 
Re: How to set the ODBCtimeout property in code
"david" <dav  2008-04-07 09:30:21 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 12:36:29 CST 2008.