title: Excel VBA Recordset is empty
body: <p>i have an ADODB recordset to load data from a view in an Excel sheet. The view is located in a MS SQL database. It runs perfectly for months, but since a few days the recordset is always empty, so i did not get any results. After a long day searching the www for any reasons i found, that it can happen because i use a x32 Excel and there is so much data in the view. So i separated the procedure in two queries. This helped a lot and the macro run perfectly again. Yesterday the same error appears again, so i began to split the procedure again. But now the recordset is still empty. I don't know any reason for this. I tested it with a selection of only ten rows of the view and this runs but if i want to get 1000 rows the recordset is empty again. Does anybody know a reason for this problem? All queries give the result i want to have in the database so they are ok.  </p>
  
  <p>Here is my code: </p>
  
  <pre><code>Sub doStuff()
      Dim sqlStatement(9) As String
      Dim lrow As Long 
      '... other variables
  
      sqlStatement(1) = "Select * from db.View1 where location like 'forest'"
      '... other sqlStatements
      For i = 0 To UBound(sqlStatement)
          Call loadData(sqlStatement, lrow)
      Next i 
  End Sub 
  
  Sub loadData(sqlStatement As String, lastrow As Long)
      Dim sqlServer As String 
      Dim dbName As String 
  
      sqlServer = "MSSQLSERVER"
      dbName = "database"
  
      On Error Resume Next
  
      Dim con As Object
      Set con = CreateObject("ADODB.Connection")
  
      con.Open _
          "Provider = sqloledb;" &amp; _
          "Data Source=" &amp; sqlServer &amp; ";" &amp; _
          "Initial Catalog=" &amp; dbName &amp; ";" &amp; _
          "User ID=user1;" &amp; _
          "Password=abcde;"
  
  
      Dim rst As Object
      Set rst = CreateObject("ADODB.Recordset")
  
      With rst
          .ActiveConnection = con
          .Open sqlStatement , con, adLockReadOnly
          ws.Activate
          If lastrow = 1 Then 
              For col = 0 To .Fields.Count - 1
                  ws.Cells(1, col + 1).Value = .Fields(col).Name
              Next
          End If 
          ws.Activate
          ws.Cells(lastrow+1,1).CopyFromRecordset rst
          .Close
      End With
  
      con.Close
      Set rst = Nothing
      Set con = Nothing
  
  End Sub
  </code></pre>