Re: opencurrentdatabase with password

  • Thread starter Thread starter domi.ico
  • Start date Start date
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
 
Back
Top