Correct order for closing & setting to Nothing

Correct order for closing & setting to Nothing

Post by MLH » Fri, 13 Oct 2006 08:21:59



MyRst.Close
Set MyRst = Nothing
MyDB.Close
Set MyDB = Nothing

Would the above be the correct order
in which to conduct the operations?
 
 
 

Correct order for closing & setting to Nothing

Post by pietlinde » Fri, 13 Oct 2006 09:08:06


sounds right. close from the "inside" to the "outside".

 
 
 

Correct order for closing & setting to Nothing

Post by pietlinde » Fri, 13 Oct 2006 09:18:58


did you fall and hit your head or something or is this midlife crisis
or something? I always opened from the outside of the hierarchy in and
then close from the inside out.
 
 
 

Correct order for closing & setting to Nothing

Post by David W. F » Fri, 13 Oct 2006 11:01:12


XXXX@XXXXX.COM wrote in




It's a simpler explanation than that:

You can't close something that's been set to Nothing, so you have to
close first, and then set to Nothing.

This is because closing it releases the object variables data
structure and setting it to Nothing removes the reference to the
memory structure. They are two independent things, so you need to do
both.

Theoretically, setting to Nothing ought to release the memory (since
no references are left), but the whole point of all of this is that
things don't work the way they're supposed to, so you have to do it
manually.

--
David W. Fenton http://www.yqcomputer.com/
usenet at dfenton dot com http://www.yqcomputer.com/
 
 
 

Correct order for closing & setting to Nothing

Post by Alan Carpe » Sat, 14 Oct 2006 07:57:27

MLH < XXXX@XXXXX.COM > wrote in



There's also the issue of "Should I close something I didn't explicitly
Open?"

This has been discussed at length in the past.

Here's one set.

http://www.yqcomputer.com/

Cheers,
Alan Carpenter
 
 
 

Correct order for closing & setting to Nothing

Post by MLH » Sat, 14 Oct 2006 12:55:46

I'm sorry. Were you replying to me or David?
 
 
 

Correct order for closing & setting to Nothing

Post by MistyCa » Sat, 14 Oct 2006 15:15:30

MLH < XXXX@XXXXX.COM > wrote in



My intention was to repy to you, but I see my aim was slightly off.
Sorry to both you and David. I know that David has the matter fully under
control.

Cheers,
Alan