Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set = nothing or close a recordset?

Status
Not open for further replies.

dirkg

Technical User
May 20, 2000
170
BE
What is the difference between:<br><br>dim rst as recordset<br><br>set rst= currentdb.openrecordset (&quot;test&quot;)<br>.....<br><br>rst.close<br><br>and<br><br>dim rst as recordset<br><br>set rst= currentdb.openrecordset (&quot;test&quot;)<br>.....<br><br>set rst = Nothing<br><br>Does it affect the memory used? If so, what is best?<br><br><br>Thanks a lot in advance!<br><br><br>Greetings,<br><br>Dirk<br><br><A HREF="mailto:dirk.news@yucom.be">dirk.news@yucom.be</A><br><br><br><br><br>
 
Does the Nothing way work?<br><br>I did not manage to make it work in my database. Closing it does work.
 
Don't forget to close it first.<br><br>rst.close<br>set rst = Nothing<br><br>
 
so what is the effect then of setting is to Nothing after you closed it? Do you free up some memory-space?
 
Using the .Close method closes the recordset.&nbsp;&nbsp;Setting the recordset to Nothing may or may not close it depending on the quality of the Microsoft implementation.<br><br>Setting the recordset to Nothing should result in deallocation of the storage for the object.&nbsp;&nbsp;Ideally, this would also happen it its a local variable and you exit the procedure.<br><br>Best practice is to first close the recordset and then set its variable to Nothing.<br><br>Best,<br><br>Harry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top