Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Set <variable>=Nothing necessary?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Michael Kaplan  
View profile  
 More options Feb 22 1999, 3:00 am
Newsgroups: comp.databases.ms-access
From: "Michael Kaplan" <mic...@spamless.trigeminal.com>
Date: 1999/02/22
Subject: Re: Set <variable>=Nothing necessary?
Everyone always has trouble with this whole idea, so I try another tack:

"Microsoft has promised that VBA will always free up object variables and
all resources associated with them when they go out of scope, and that
therefore you do not strictly need to do this. Thus, if you trust Microsoft
that much, never bother to close or set to nothing and everything will be
peachy.

If you believe there may be one or more bugs in a feature that Microsoft has
implemented, you may decide it is in your best interest to explicitly close
what you open and always set object variables to nothing, without exception,
just in case one of these bugs would keep Access from being able to close or
would tie up system resources while your app is running. Its up to you."

Maybe people will listen to it this way? :-)

Michael

Terry Kreft <terry.kr...@mps.co.uk> wrote in message

news:7arq84$aae$1@gate.mps.co.uk...
> Hi Bill,
> In theory all objects are set to nothing when they go out of scope, in
> practice it doesn't always happen.

> IMO, always set to nothing, if you hit the problem where the ROT isn't
> cleared properly it's the devils own job finding where it's happening, far
> easier in the long run to get in the habit of removing the objects
yourself.

> Bill Berry wrote in message ...
> >I want a rule-of-thumb on whether every procedure that uses a local
> >recordset (or other DAO) object variable needs to have Set
> <objname>=Nothing
> >at the end.

> >I understand that there are many dark corners and details to this issue,
> but
> >I'mmainly concerned with the simple scenarios exemplified below:

> >I'm writing a function (that may be called hundreds of times per day)
that
> >uses a recordset object to look up some data. I'm just returning a string
> >value from the function, not any objectreferences. All variables in the
> >procedure are local-to-the-procedure in scope. If one of those variables
is
> >a recordset, will it automatically be "set to Nothing" when it goes out
of
> >scope (i.e. the procedure finishes) or do I have to manually do a
> >Set<variable>=Nothing ?.

> >I want to do the right thing to keep memory "clean and tidy", but I don't
> >want to have (lots of?!) Set <variable>=Nothing statements which are
> >functionally redundant.

> >Please help me with the straight scoop on this basic situation. TIA

> >Bill Berry


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.