Opening a Database as the Current Database and Closing the Current Database
Sub open() Dim myAccess As Access.Application Dim myDatabase As Object
Set myAccess = GetObject(, "Access.Application")
myAccess.CloseCurrentDatabase
myAccess.OpenCurrentDatabase _
filepath:="C:\mydb.mdb", Exclusive:=True
Set myDatabase = myAccess.CurrentDb End Sub