close and open connections

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If my code opens a connection string:

cnn.open fstrCnn()

is a new connection opened every time it passes this line, or is it just the
one connection if it's already open?

I have a function that supplies recordsets to other functions. If I supply 3
different recordsets, do I close the connection 3 times or once?
Hope it's clear what I'm trying to ask.

Thanks guys!!
 
Even if the connection object is declared globally, only one connection is
opened.

Unless there is a very compelling reason for doing otherwise, you should
always explicitly close everything you've opened, as soon as you've have
finished using it. So once your functions have finished using the recordsets
passed to them, you should close the recordsets AND the connection.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
 
Back
Top