View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
onedaywhen onedaywhen is offline
external usenet poster
 
Posts: 459
Default Open Access database(DAO) with password protected

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

--

"Yanto" wrote in message ...
Hi All,

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

Yanto