Set object = Nothing but not object.Close

  • Thread starter Thread starter S.L.
  • Start date Start date
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
 
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.
 
Back
Top