title: Access close Recordset in error handling
body: <p>I was wondering about error handling. If an error occurs during code execution, and I have a recordset open, should I close it? Attempting a recordset.close operation can raise an error, and since I'm inside an error handling code part, it will be an unhandled error.</p>
  
  <p>If I send the code back to continue at another label, then it can become infinite loop. Now adding one boolean to check if this is the first time the error appeared would work, but do I really need all this fuss? <strong>Will the connection stay open if the code terminates and I don't close it? Will it cause trouble later?</strong></p>
  
  <pre><code>Dim rs As DAO.Recordset
  
  Set rs = CurrentDB.OpenRecordset("SELECT * FROM tblSetting")
  On Error GoTo handler
  
      'do things
  
  rs.Close
  Set rs = Nothing
  
  Exit Sub
  
  handler:
   rs.Close
   'Set rs = Nothing '-this one is not necessary, as terminating the sub should clear up all references to it, hence Garbage Collector can pick it up
  End Sub
  </code></pre>
  
  <p>This would work, but... really?</p>
  
  <pre><code>...
  Termination:
    rs.Close
    Set rs = Nothing
  Exit Sub
  
  handler:
   if ErrorHappened=True then
    msgbox "fatal error"
    exit sub
   else
    ErrorHappened=True
    resume termination
   End If
  </code></pre>
  
  <p>Thank you!</p>