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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How important is it to close a recordset

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi all, I have asked myself this question a 1000 times without ever really knowing the answer so I thought I'd ask other people. How important is it to close a recordset at the end of a procedure? What difference does it make?
 
I'm not sure. Other than releasing memory I believe that's it. So, it would depend on the computer it is being run. the traffic, and the amount of memory being consumed by using the recordset(s). If it were a server it would probably be crucial. Try creating a subroutine that runs inside a loop and creates a recordset without using either close or set to nothing. Print out the number of times it loops to the immediate window and see when it crashes or locks up. Remember those times when the system locked and you had to knowledge of why?

Anyone else have a contribution?
----------------------
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
 
Well, I have often wondered what the answer to this question is as well. I always close a recordset after I'm finished with it because I think it is good programming practice. However, Access releases a recordset when it goes out of scope, so I'm not sure if closing it has any tangible benefit such as releasing memory. I look forward to reading comments from others.

Best, dz
dzaccess@yahoo.com
 
According to the Microsoft Knowledgebase there can be three affects; the sometimes loss of memory (it does say when it goes out of scope is usually recovers this memory), filesize bloat, and occasionally the inability to close the Access database if the DAO recordset is not closed. It does not attempt to quantify the impact.


----------------------
scking@arinc.com
Life is filled with lessons.
We are responsible for the
results of the quizzes.
-----------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top