Shamil
Active member
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 isnt destroyed by .Quit(...) method call. Setting MS Access instances object reference to Nothing or setting DAO.Database variable instance to Nothing doesnt 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 isnt 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
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 isnt destroyed by .Quit(...) method call. Setting MS Access instances object reference to Nothing or setting DAO.Database variable instance to Nothing doesnt 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 isnt 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