p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

vba_access thread: Re: DAO question


Message #1 by "Donald Carroll" <dcarroll@f...> on Mon, 9 Jul 2001 23:07:29
As long as you put them in a logical order you shouldn't have any problems.

rs.Close
db.Close
Set rs = Nothing
Set db = Nothing

or

rs.Close
Set rs = Nothing
db.Close
Set db = Nothing

I have a website at www.61minutes.com that has some basic DAO information.

Best Regards,

Vince.

-----Original Message-----
From: Donald Carroll [mailto:dcarroll@f...]
Sent: 09 July 2001 23:07
To: VBA_Access
Subject: [vba_access] Re: DAO question


What I use is:

rs.Close
db.Close

They both seem to work just fine.  Closing a recordset does not affect a 
clone.

Donald

> I have been looking all over the net for some concrete examples of the 
> correct way to close/destroy recordset, database, etc. objects in DAO.  
> Basically I have the code:
> 
> dim db as database
> dim rs as recordset
> 
> set db=currentdb
> set rs=db.openrecordset(blah blah)
> 
> Now, what is the correct way to close both of those objects? Do I use
> 
> rs.close
> set db=nothing
> 
> or 
> 
> rs.close
> set rs=nothing
> db.close
> set db=nothing
> 
> or some other permutation?  Can't find any good documentation on DAO.  
The 
> Access 97 help files help in some areas, but they don't always give you 
> examples of 'good coding practices'.   Any help on this subject as well 
as 
> links to good web documentation would be appreciated.
> 
> Thanks in advance,
> B


  Return to Index