The rule I learned was:
If you open it, close it
If you create it, destroy it.
Example:
Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("SavedQuery")
If Not (rs.BOF And rs.EOF) Then
' do something here
End If
rs.Close ' opened it, so close it
Set rs = Nothing ' created it, so destroy it
' db.Close ' Did not open it, so do not close it
Set db = Nothing ' created it, so destroy it
End Sub
BTW, "Currentdb.Execute " is faster for action queries because it bypasses Access and is executed in/by Jet. But if you have a lot of calls to open or manipulate recordsets, it is faster to use the "Set db = CurrentDb()" construct.
My $0.02.......