Open Access database(DAO) with password protected

Y

Yanto

Hi All,

How to open Ms Access database (DAO) with password protected using
OPENDATABASE method?
Set dbs = DAO.DBEngine.Workspaces(0).OpenDatabase("c:\ABC.MDB")
Where I have to put the password?
TIA

Yanto
 
O

onedaywhen

You'll find more support in these ng if you use ADO. FWIW, here's some
DAO code to open a .mdb Jet database file using workgroup security:

Sub test()
Dim wks As DAO.Workspace
Dim db As DAO.Database

With DAO.DBEngine
.DefaultUser = "sa"
.DefaultPassword = "password"
.SystemDB = "C:\MSOffice\Access\system.mdw"
Set wks = .CreateWorkspace("Working", "sa", "password")
End With

Set db = wks.OpenDatabase("c:\MyDB.mdb", True, False)

' code continues ...

End Sub
 

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