Set to Nothing

Tsango

Registered User.
Local time
Today, 23:08
Joined
Mar 31, 2006
Messages
64
How important is it to set 'stuff' to NOTHING in the following?

Dim cnn As ADODB.Connection
Dim rstCustomers As New ADODB.Recordset

What happens if you don't?

Anyone konw?
 
You only set things = Nothing that you have set to something previously. The Dim statement does not require memory. Access is "pretty" good at releasing memory when an object goes out of scope. It is simply good programming practice to release any object that you have set and not assume Access will take care of it for you.
 
RuralGuy said:
You only set things = Nothing that you have set to something previously. The Dim statement does not require memory. Access is "pretty" good at releasing memory when an object goes out of scope. It is simply good programming practice to release any object that you have set and not assume Access will take care of it for you.


Sorry yes, I have set them to something like so

Set cnn = CurrentProject.Connection

rstTable.Open "Table", cnn, adOpenStatic, adCmdTable

Just wondered if I was piling up a massive problem somewhere as I haven't set anything back to nothing anywhere in my application. I have started and done about 120 incidents so far...!!!!
 

Users who are viewing this thread

Back
Top Bottom