Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231

    Unanswered: Best way to release recordset resources?

    Just curious, is it better to use rs.Close or Set rs = Nothing after you're done with a recordset. Or does it even matter? Thanks.

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by jmahaffie
    Just curious, is it better to use rs.Close or Set rs = Nothing after you're done with a recordset. Or does it even matter? Thanks.
    Close does just that ... closes the recordset.

    Setting the recordset variable to Nothing does the actual releasing of memory and resources ...
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    Exactly what I wanted to know. Thanks. Would it still be considered "proper form" or whatever you wanna call it to simply Set rs = Nothing without closing it first? Any harm done?

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by jmahaffie
    Exactly what I wanted to know. Thanks. Would it still be considered "proper form" or whatever you wanna call it to simply Set rs = Nothing without closing it first? Any harm done?
    No. Access closes the recordset for you then ...
    Back to Access ... ADO is not the way to go for speed ...

  5. #5
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004
    Quote Originally Posted by M Owen
    No. Access closes the recordset for you then ...
    Hey M Owen,

    So what you are saying is simply use Set rs=Nothing not only will release the resources, but also Closes the recordset as well? Would there be a case where you should use both of those together? Trying to learn a thing or two here and want to be clear on it.

    thanks
    BUD

  6. #6
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    441
    The help files claim that, look up the Close method of DAO recordset:

    "An alternative to the Close method is to set the value of an object variable to Nothing (Set dbsTemp = Nothing)"

    Whether or not to rely upon it, well, that's your decision, I've never dared
    Roy-Vidar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •