Shamil Posted November 8, 2003 Posted November 8, 2003 Hi All, Here is a simple VB.NET MS Access Automation code. It works well except that when the code lines: dbs = .CurrentDb Debug.WriteLine(dbs.Name) dbs = Nothing from the below code are uncommented then MS Access instance isn't destroyed by .Quit(...) method call. Setting MS Access instance's object reference to Nothing or setting DAO.Database variable instance to Nothing doesn't help. Dim app As Access.Application Dim dbs As DAO.Database app = New Access.Application() With app .OpenCurrentDatabase("<you test database fullpath>") .Visible = True ' ' when the following three code lines ' are uncommented MS Access instance isn't destroyed ' when .Quit(...) is executed... 'dbs = .CurrentDb 'Debug.WriteLine(dbs.Name) 'dbs = Nothing .CloseCurrentDatabase() .Quit(Access.AcQuitOption.acQuitSaveNone) End With app = Nothing The question is: How to force MS Access instance to be destroyed? TIA for any tips and tricks! Shamil Quote e-mail: shamil-usersATmns.ru
Shamil Posted November 8, 2003 Author Posted November 8, 2003 GC.Collect() solves the trouble. Sorry for bothering you with my silly question. Shamil Quote e-mail: shamil-usersATmns.ru
Recommended Posts