E
Ed Ardzinski
I found this code in a KB article to connect an ADO recordset to a form - it
seems to work fine. But some of the SQL Server queries are more complex than
others, and I am getting occasional timeout errors. It would *seem* to be a
simple fix, but I don't see any change in the timeout period:
(Access 2003 on a Win XP Pro box. pStr is being set to a valid SQL Statement
prior.)
Private Sub Form_Load()
Dim db As ADODB.Connection
Dim cmd As ADODB.Command
Dim rs As ADODB.Recordset
Dim rsa As ADODB.Recordset
Set db = New ADODB.Connection
With db
.Provider = "Microsoft.Access.OLEDB.10.0"
.Properties("Data Provider").Value = "SQLOLEDB"
.Properties("Data Source").Value = "******"
.Properties("User ID").Value = "******"
.Properties("Password").Value = "******"
.Properties("Initial Catalog").Value = "********"
End With
Set cmd = New ADODB.Command
cmd.CommandText = pStr
db.ConnectionTimeout = 0
db.Open
cmd.ActiveConnection = db
Set rs = New ADODB.Recordset
rs.Open cmd
---- So my question is can the timeout be set for this provider? And if so
where/how do I do it? TIA
seems to work fine. But some of the SQL Server queries are more complex than
others, and I am getting occasional timeout errors. It would *seem* to be a
simple fix, but I don't see any change in the timeout period:
(Access 2003 on a Win XP Pro box. pStr is being set to a valid SQL Statement
prior.)
Private Sub Form_Load()
Dim db As ADODB.Connection
Dim cmd As ADODB.Command
Dim rs As ADODB.Recordset
Dim rsa As ADODB.Recordset
Set db = New ADODB.Connection
With db
.Provider = "Microsoft.Access.OLEDB.10.0"
.Properties("Data Provider").Value = "SQLOLEDB"
.Properties("Data Source").Value = "******"
.Properties("User ID").Value = "******"
.Properties("Password").Value = "******"
.Properties("Initial Catalog").Value = "********"
End With
Set cmd = New ADODB.Command
cmd.CommandText = pStr
db.ConnectionTimeout = 0
db.Open
cmd.ActiveConnection = db
Set rs = New ADODB.Recordset
rs.Open cmd
---- So my question is can the timeout be set for this provider? And if so
where/how do I do it? TIA