D
domi.ico
Try following :
Public Sub TestOpenAccessDB()
Dim strDbName As String
Dim ACCapplic As Access.Application
Dim DAOdb As DAO.Database
' Create Automation object.
Set ACCapplic = New Access.Application
' Open DB (without password)
strDbName = "C:\XXXXX.mdb"
ACCapplic.OpenCurrentDatabase strDbName, False
' Open DB (with password)
strDbName = "C:\ZZZZZ.mdb"
Set DAOdb = ACCapplic.DBEngine.OpenDatabase(strDbName, False, False,
";pwd=test;")
ACCapplic.OpenCurrentDatabase strDbName, False
DAOdb.Close
Set DAOdb = Nothing
' ..........................
End Sub
Public Sub TestOpenAccessDB()
Dim strDbName As String
Dim ACCapplic As Access.Application
Dim DAOdb As DAO.Database
' Create Automation object.
Set ACCapplic = New Access.Application
' Open DB (without password)
strDbName = "C:\XXXXX.mdb"
ACCapplic.OpenCurrentDatabase strDbName, False
' Open DB (with password)
strDbName = "C:\ZZZZZ.mdb"
Set DAOdb = ACCapplic.DBEngine.OpenDatabase(strDbName, False, False,
";pwd=test;")
ACCapplic.OpenCurrentDatabase strDbName, False
DAOdb.Close
Set DAOdb = Nothing
' ..........................
End Sub