All versions of Access were supposed to close recordsets and uninstantiate
them as well.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)
"Nick Giordano" <ni...@njginc.com> wrote in message
news:eTcsrtmu...@TK2MSFTNGP03.phx.gbl...
"Douglas J. Steele" <NOSPAM_djsteele@NOSPAM_canada.com> wrote in message
news:epblMAou...@TK2MSFTNGP03.phx.gbl...
Well, setting to nothing would mean at that point the close method would not
work any more (it would fail, as the
recordset would not be open anymore!!).
....
Just from a logic point of view, to clean up...one would presumably close,
and then set the var = nothing.
as for both being necessary? Well, as mentioned, it has been a time honoured
and standard practice for years.
I still do both, much out of habit..but, as a coding practice, it still is
recommend...
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOO...@msn.com
Hi,
In the COM world, within Scripting, VBA or VB6, it is a myth that you must
do it.
In fact, in the past, when there were leaks in the ADO-COM objects, you had
to explicitely clean up. Currently, the unmanaged destructors and
smartpointers that C++ programmers use, garantuee, that COM resources, are
not waisted.
Setting an object to nothing, while the End Sub or the 'end of scope' is
near, is really a bogus statement.
Closing a recordset, while the End of Scope is near, is not necessary as
well.
I'm sure, that some purists now will hit and slam me!
Douglas Steele remembers the Access 97 days, when we all found ourselves
with database that we could not close. Access would just minimize to the
task bar when you tried to close it, so killing it with Ctl+Alt+Del was the
only way. Failure to set Recordset variables to Nothing ended up being one
of the causes. It was a hellava job to debug these databases, so many of us
became super cautious about cleaning up after ourselves.
AFAIK, the issue was fixed years ago, but I'm still not trusting VBA to get
this right 100% of the time. It just wasn't worth the effort NOT to do it.
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Egbert Nierop (MVP for IIS)" <egbert...@nospam.invalid> wrote in
message
news:ur9eEt6u...@TK2MSFTNGP06.phx.gbl...
That's true.
Today, I know no such products :)
Especially, since ADO was rewritten using good COM practices.
( A lot of old MS platform SDK code, reveals that many C++ programmers,
loved to write their own IUnknown implementations which were not thread
safe)
Of course, most of us continue to use DAO with Access, since it's superior
to ADO interacting with Jet.
Which is one reason why many of the MS examples show
closing and setting to nothing: the samples are valid for ASP
as well as VB, VBA, and VBS.
Also, in Access 2000+ you have to be careful inside the
before-update and after-update events of a form, because
error handling doesn't work correctly there, and you can loose
objects (although a total Access crash is more likely)..
On the other hand, indiscriminately 'closing' objects can be
just as bad. Attempting to 'close' instances of CodeDB or
CurrentDB can detach an open recordset, preventing Access
from closing it, and preventing Access from closing.
(david)
"Egbert Nierop (MVP for IIS)" <egbert...@nospam.invalid> wrote in
message news:ur9eEt6u...@TK2MSFTNGP06.phx.gbl...