title: Access ADO: operation is not allowed when the object is closed error message
body: <p>I am using Access 2003 with a local table which will later be transferred and linked to a SQL Server 2008 table. I am using the following code but get the error: "Run-time error 3704: Operation is not allowed when the object is closed" on the cnn.Execute line.</p>
  
  <pre><code>sub test()
  On Err GoTo Err_Sub
      Dim cnn As ADODB.Connection
      Dim rs As ADODB.Recordset
  
      Dim str As String
      Dim strSQL As String
  
      'Open a connection.
      Set cnn = New ADODB.Connection     
      cnn.ConnectionString = _
          "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _
          "Data Source=" &amp; CurrentDb.Name &amp; ";" &amp; _
          "Persist Security Info=False"
  
      strSQL = Me.RecordSource
      str = Mid(strSQL, InStr(strSQL, "Where "))
      strSQL = "Update  myTable SET Active = False " &amp; str
  
      Set rs = cnn.Execute(strSQL)
  
      If Not rs Is Nothing Then rs.Close
  
  Exit_Sub:
      Set rs = Nothing
      Exit Sub
  
  Err_Sub:
      MsgBox Err.Description
      Resume Exit_Sub
  End Sub
  </code></pre>