L
Lisab
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 temporary 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 temporary 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
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 temporary 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 temporary 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