Set object = Nothing but not object.Close

S

S.L.

If before I exit my routine, I write only
Set object = Nothing
But I not write
object.Close
Will it prevent MS Access to close application ?

TIA
 
D

Dirk Goldgar

S.L. said:
If before I exit my routine, I write only
Set object = Nothing
But I not write
object.Close
Will it prevent MS Access to close application ?

Not normally. However, it's a good idea to explicitly close any object
you explicitly opened. If there's some question as to whether a
recordset object (for example) is open at the end of the procedure, I
usually put code along the lines of

On Error Resume Next
If Not rs Is Nothing Then rs.Close
Set rs = Nothing

in the exit logic.
 

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