There lies the rub. Old versions of VB and VBA definitely did leak
I wanted to indulge in a little polemics, so I didn't go into
detail, but even historically, setting a recordset to nothing
immediately before it was automatically set to nothing was
never important. What was (and perhaps still is) important
was CLOSING a recordset before it was automatically set to
nothing, and CLOSING a recordset before it was reused (as in
a loop, or when using global variables).
http://support.microsoft.com/default.aspx?scid=kb;en-us;209847
An object should automatically close when it's reference count
goes to zero, but this is a delayed process, and if there is a
problem in the reference counting (a lost reference), then
explicitly closing the object is necessary.
Some objects don't have a close method, and the only way to
get them to close is to reduce the reference count to zero.
For these objects, there is no fix for circular references
or lost references, and the only solution is to avoid problems
(for example, not directly referring to checkbox controls in
VB If statements).
Circular references can be broken by setting the references
to nothing IF THEY ARE EXPOSED, which is a minor reason why
people get into the habit of setting their references to nothing.
(The IMPORTANT reason is because they are working in an environment
that does not automatically set their references to nothing)
The DAO error object may create circular references (?), but
they are not exposed: none of the built in objects expose
circular references that you could break by setting an object
to nothing.
Regarding 'appearances' (part of my concluding remarks), some
people ALWAYS set a reference to nothing if they have previously
set it to something. The MS style for VB code fragments now is
to use "set RS=nothing". This is a coding practice. I regard it
as a bad coding practice in a well designed Access application,
but only because I adopt a different coding practice: I never use
module-level variables. I regard module-level variables as bad
coding practice, and I think that they should be avoided in all
but the most rare circumstances.
In a well designed Access application, listing your variables
at the end of each subroutine is redundant, adds to code size
and code complexity, and is therefore wrong. However, there
are different coding styles, and if you want to list all or
some of your local variables at then end of each subroutine,
then I would only say: it is good to be consistent: find a style
and stick with it :~).
(david)