Chenging default query execution time limit in VBA code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mdanesh
    New Member
    • Sep 2006
    • 1

    Chenging default query execution time limit in VBA code

    I have a VBA macro code that runs a SQL query (that is coppied from MS ACCESS) and it is using record set definition in VBA. It works fine, but it times out before it is done. I believe it is because of the timeout limitation that is set to 60 seconds by default. Could anyone show me how to change the time limit for the query execution in VBA? My VBA code is as follows:

    Code:
      
       Dim Conn As Connection
       Dim rs As Recordset
       Dim cmd As Command
       Set Conn = CreateObject("ADODB.Connection")
       Set rs = CreateObject("ADODB.Recordset")
       Set cmd = CreateObject("ADODB.Command")
       Conn.Open "Provider=SQLOLEDB;
       Integrated Security=SSPI;Initial Catalog=cAT00;Data Source=SQ000"
    
       cmd.ActiveConnection = Conn
       Sql = <SQL statement>
       cmd.CommandText = Sql
       Set rs = cmd.Execute
Working...