When is it appropriate to "close" objects?
Example. Which of these objects should be "closed"?
Dim Wsp as Workspace
Dim Dbf as DataBase
Dim Rstb as Recordset
Dim Tdf As TableDef
Dim Cdb As DataBase
Set Wsp = DBEngine.Worksp aces(0)
Set Dbf = Wsp.OpenDatabas e(path & "DatabaseName.m db")
Set Rstb = Dbf.OpenRecords et("TblInfo", dbOpenDynaset)
Set Cdb = CurrentDb
Normally, I just "close" the database object like this.....
Set Dbf = Nothing or Set Cdb = Nothing
Is that sufficient? Is it the correct way?
Is it the same as this?
Dbf.close
Should I be setting them all to "nothing"?
Set Wsp = Nothing
Set Rstb = Nothing
Set Dbf = Nothing
Set Cdb = Nothing
Set Tdf = Nothing
Should they all be "closed"?
Wsp.Close
Rstb.Close
Dbf.Close
Cdb.Close
Tdf .Close
By not setting them all to nothing, or by not "closing" them all, am I
wasting memory?
Thanks for any help!