Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

e-mail: shamil-usersATmns.ru
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...