Close vs Nothing

D

Dave

Hi,
Can anyone explain the difference and benefit (if any) between using the
close statement and the Nothing statement?
For example, when I clean up at the end of a procedure:

rst.Close

OR

set rst = Nothing

Thanks
Dave
 
D

david epsom dot com dot au

When you set a recordset to nothing, it is supposed to
close the recordset if nothing else is using it.

When you close a recordset, it closes the recordset even
if something else is using it.

If you sensibly only use the recordset once, in one place,
then it makes no difference if you close the recordset, or
set it to nothing, or let it go out of scope.

Apart from that, there are various arguments based on coding
style, which environment you are using (asp frequently has
different scope than Access VBA), and bugs in long gone
versions of Access.

(david)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top