According to this answer, the moment a variable goes out of scope then the object's resources will be automatically released by VB. Question: is it okay if I used With...End
when opening a DAO.Recordset since the resources is supposed to be cleaned up when the Sub
goes out of scope, or should I still need to explicitly Close
and set objects to Nothing
?
For example,
Sub Test()
With CurrentDb.OpenRecordset("SELECT * FROM Table1", dbOpenForwardOnly)
IsThisAGoodPractice()
End With
End Sub