I i use a conn similar:
...
Set CONN = New ADODB.Connection
strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\....
...
i need to use:
conn.close
set conn=nothing
to the and of code, or the satatement Set CONN = New ADODB.Connection automaticlly destroyed all conn object???
note:
i use the conn recursivlly
understand a closed object conn
-
- Administrator
- Posts: 78474
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: understand a closed object conn
You should close the connection before opening a new one, but if you use Set conn = New ADODB.Connection, you don't need to use Set Conn = Nothing before that. So either use
conn.Close
Set conn = Nothing
when you don't need conn any more, or
conn.Close
Set conn = New ADODB.Connection
when you want to create a new connection.
conn.Close
Set conn = Nothing
when you don't need conn any more, or
conn.Close
Set conn = New ADODB.Connection
when you want to create a new connection.
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4355
- Joined: 26 Apr 2010, 17:36
Re: understand a closed object conn
now all is clear!HansV wrote:You should close the connection before opening a new one, but if you use Set conn = New ADODB.Connection, you don't need to use Set Conn = Nothing before that. So either use
conn.Close
Set conn = Nothing
when you don't need conn any more, or
conn.Close
Set conn = New ADODB.Connection
when you want to create a new connection.
tks.