Close external Access DB

S

Shirley

How to close an external Access DB that was not open by the current DB?

I posted the same question in Mudules sesstion, which I found is not very
active.

Great thanks,

Shirley
 
J

Juan M Afan de Ribera

Hi,

try this code

Function CloseExDatabase(DbName As String) As Boolean
Dim oApp As Object

On Error Resume Next
Set oApp = GetObject(DbName)
On Error GoTo 0

If Not oApp Is Nothing Then
oApp.CloseCurrentDatabase
oApp.Quit
Set oApp = Nothing
CloseExDatabase = True
End If

End Function



Saludos,
Juan M Afan de Ribera
[MVP Access]
http://www.mvp-access.com/juanmafan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top