title: ADODB.Recordset: Operation is not allowed when the object is closed
body: <p>I receive the error - ADODB.Recordset: Operation is not allowed when the object is closed. when using a multiple table sql statement.</p>
  
  <p>other sql statements (simple ones) I do not receive and error, and I have copied the sql statement into query to verify it works ok in MSSQL from printed out sql variable - and it does return values.</p>
  
  <p>Method</p>
  
  <pre><code>sql = "SET NOCOUNT ON;SET ANSI_WARNINGS OFF;use dbcheck; " &amp;_
  "select year([00080020]) as YEAR, month([00080020]) as MONTH,sum(bytesize/1024/1024/1024) as GBStored, count(distinct [0020000d]) " &amp;_
  " as FinalCount from tblt t, tbls s, tblf f where" &amp;_
  " id1 = _id1 and id2 = _id2file" &amp;_
  " and [00080020] is not null" &amp;_
  " group by year([00080020]), month([00080020]) order by year([00080020]) desc, month([00080020]) desc"
  
  Dim cndb : Set cndb = CreateObject("ADODB.Connection")
  Dim rsdb: Set rsdb = CreateObject("ADODB.Recordset")
  cndb.Provider = "sqloledb"
  cndb.Properties("Data Source").Value = "127.0.0.1"
  cndb.Properties("Initial Catalog").Value = "master"
  cndb.Properties("Integrated Security").Value = "SSPI"
  
  cndb.CursorLocation = 3
  cndb.Open
  set rsdb = CreateObject ("ADODB.Recordset")
  cmd.ActiveConnection = cndb
  cmd.CommandType = 1
  cmd.CommandText = sql
  rsdb.CursorLocation = 3
  rsdb.CursorType = 3
  rsdb.LockType = 3
  Set rsdb = cmd.Execute
      IF Not (rsdb IS Nothing) Then
      rsdb.MoveFirst ** ERRORS OUT HERE
  </code></pre>
  
  <p>Thanks
  --------2nd attempt sql is same</p>
  
  <pre><code>Dim cndb : Set cndb = CreateObject("ADODB.Connection")
  Dim rsdb: Set rsdb = CreateObject("ADODB.Recordset")
  
  cndb.Provider = "sqloledb"
  ' Set SQLOLEDB connection properties.
  cndb.Properties("Data Source").Value = "127.0.0.1"
  cndb.Properties("Initial Catalog").Value = "master"
  
  ' Windows NT authentication.
  cndb.Properties("Integrated Security").Value = "SSPI"
  
  cndb.CommandTimeout=900
  cndb.CursorLocation = 3
  cndb.Open
  
  rsdb.CursorLocation = 3
  rsdb.CursorType = 3
  rsdb.LockType = 3
  rsdb.Open sql,cndb
  
  rptFile.WriteLine sql
  rptFile.WriteLine cndb.State
  rptFile.WriteLine rsdb.State
  
  IF Not (rsdb IS Nothing) Then
    If Not rsdb.EOF Then  * Errors out on this line
      rsdb.MoveFirst
  </code></pre>