ODBC timeout - pls help

  • Thread starter Thread starter dscflorida
  • Start date Start date
D

dscflorida

Guest
I can't seem to get the ConnectionTimeout or the QueryTimeout to work on this code. The code defines then executes a query, then keeps timing out at exactly 60 seconds, so I know it's using the general default, and not recognizing my attempt to set ConnectionTimeout and QueryTimeout properties to ZERO (0)

From the access screens via the query builder QBE format, the exact query that I define in my script runs just fine, as I can set the ODBC timeout to 120 sec or 0 (either works) in the "Properties" from the toolbar.

In the script, I have set (I believe) both connection and query timeouts to 0, but the script still thrashes the cpu for 60 seconds and then I get the error, "ODBC - - call failed"....

Thanks for anyone to look at the code for what's not correct...

I didn't bother with including the whole definition of the query, as it is a little detailed...but I can assure you that when I cut and paste the same query into the QBE, the query works just fine. It just seems that for some reason, my property settings just don't take affect in the script.

I think I'm caught betwixt ADO and DAO....ARRRRRGGGGGHHHHHHH!

Here is the code, thanks,

Don Clark / Florida

============================================

Dim CurDB As Database
Dim conDB As ADODB.Connection
Dim rsCurrent As ADODB.Recordset
Dim sSQLCurrent As String

Set conDB = New ADODB.Connection
Set rsCurrent = New ADODB.Recordset
Set CurDB = CurrentDb

With conDB
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "data source =" & CurDB.Name
.ConnectionTimeout = 0
.Open
End With

CurDB.QueryTimeout = 0

'open / delete all records / leave open to add later / in "points" table

rspoints.Open "delete * from points;", conDB
rspoints.Open "select * from points;", conDB, adOpenKeyset, adLockOptimistic

Me![lblStatus].Caption = "Getting Records!"
Me.Refresh

'set/define Query

sSQLCurrent = "SELECT dbo_SERIAL_EQUIP.MODEL, " & _
"dbo_SERIAL_EQUIP.SERIAL, " & _
"dbo_SERIAL_EQUIP.EQUIP_ID, " & _
"dbo_SERV_CALL_COST.METER_READING_SCC, " & _
"dbo_SERV_CALL.COMPLETE_DATE_SCA, " & _
"dbo_SERV_CALL.CALL_TYPE " & _
"FROM (dbo_SERV_CALL INNER JOIN dbo_SERIAL_EQUIP ON " & _
"(dbo_SERV_CALL.MODEL = dbo_SERIAL_EQUIP.MODEL) " & _
"AND (dbo_SERV_CALL.SERIAL = dbo_SERIAL_EQUIP.SERIAL)) " & _
"INNER JOIN dbo_SERV_CALL_COST " & _
"ON (dbo_SERV_CALL.MODEL = dbo_SERV_CALL_COST.MODEL) " & _

....AND/AND/AND/WHERE/ORDER BY....ETC

'run the query

rsCurrent.Open sSQLCurrent, conDB, adOpenStatic, adLockReadOnly

'ERROR "ODBC - - call failed"

===========================================
 

Users who are viewing this thread

Back
Top Bottom