Darryl Kerkeslager wrote:
With ADO in A2000+,
Dim cnxn As ADODB.Connection
Set cnxn = CurrentProject.Connection
cnxn.Execute "INSERT ..."
This works in MDB, not just ADP. I have seen no benefit in closing this
connection (quite the contrary) or setting it to nothing. There is a
benefit in closing and setting recordsets to nothing, of course.
The OP wants to do this from MS Word, so CurrentProject.Connection won't
work :-( It would also be an idea to close it afterwards from there.
BTW I would close the connection in Access if it were a local variable,
I know it just points to an already established connection but it's
still a variable and uses resources, which I wouldn't trust Access VBA
alone to clean it up and release. Too often with all the apps I run, the
system's using 256MB RAM after I close all apps, when I boot up it's
using 128MB so something somewhere is using 128MB RAM and not releasing
it, I wouldn't try to compound that by not cleaning up my variables,
it's bad enough in Windows without me being sloppy and adding to the
problem.
In general, like when I use DAO I have a global Database variable that I
set to the currentdb. This remains available for instant use all the
time from anywhere without having to Set/Open, etc before use. Then I
clean it up before exiting the app.
--
\\\\\\
\\ \\ Windows is searching
\ \ For your sig.
\ \ Please Wait.
\__\