Re: Releasing Object Variables
- From: "David W. Fenton" <dXXXfenton@xxxxxxxxxxxxxxxx>
- Date: Thu, 21 Jul 2005 12:43:51 -0500
"lylefair" <lylefair@xxxxxxxx> wrote in
news:1121950491.487212.132420@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:
> Can you post code, or a reference to a md? or ad? file on a
> website, where object variables are not released when they go out
> of scope and cause a problem, (but causing a problem is extraneous
> to this question), other than these two:
> DAO.Database
> DAO.Recordset
I don't know of any. But I follow a principle given my MichKa, whose
judgment I trust, and that is to clean up any object variables that
are SET in code, or implicitly in For/Each statements.
I'm now considering adding WITH statements, but if I do that, the
benefit of a WITH over using an object variable disappears.
I suspect that:
For Each ctl In Me.Controls
is not going to create a problematic implicit reference, whereas
code called from elsewhere:
For Each ctl in Forms!MyForm.Controls
might run the risk of leaving an implicit variable.
Reference counting is inherently flawed as a cleanup method and
there could be any number of reasons why it will fail in some
contexts.
Identifying explicit and implicit object references is, I think, not
a bad thing for helping one fully understand one's own code, so I'm
not upset about the voodoo aspect of it.
The longer I'm involved in computers professionally, the less
rational running computers looks to me. The line that makes my
clients laugh is that I tell them to do whatever to their computer
and then to sacrifice two chickens and sprinkle the blood over the
PC. Sometimes the way these boxes behave really does look like it
was the chicken blood that fixed the problem.
--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
.
- References:
- Releasing Object Variables
- From: lylefair
- Releasing Object Variables
- Prev by Date: Re: Is Name Autocorrect fixed in Access 2003?
- Next by Date: Create tables Using VBA
- Previous by thread: Re: Releasing Object Variables
- Next by thread: An experience in linking Blackboard learning system backend to Access
- Index(es):
Relevant Pages
|