Do I have to close an odc in a macro?

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

Guest

I have set up a macro in Excel that imports Access queries. The number of
queries the macro imports varies depending upon the number of changes showing
on the summary tab in my workbook. For each change, there are 3 queries that
run and I have an odc for each query. After the query is run, does the odc
have to be "closed"? I get an error if there are several changes on my
summary sheet.
 
The general rule that I follow is to always clean things up when you are done
playing (I gave my son the same rule to follow, but that is completely
different). If you are done with a connection close it and set it to nothing.
You will never go wrong following this guide line. Truth be known I could not
tell you what difficulties you might run into if you leave the connections
open because I have never been curious enough to find out.
 
Tachikrusher,
You mean you currently:
Open connection, Issue query, Close connection.
Open connection, Issue query, Close connection.
Open connection, Issue query, Close connection.
for each change ?

Or
Open connection, Issue query, Issue query, Issue query, Close connection.

Also which error ?

NickHK
 
Back
Top