close and open connections

S

smk23

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!!
 
G

Graham R Seach

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top