Is it possible to set and unset MS Access database password from VB ?
:p Kinjal :p
Printable View
Is it possible to set and unset MS Access database password from VB ?
:p Kinjal :p
Sure thing!
Here's to code to SET the password from VB:
Here's to code to OPEN the password-protected DB from VB:Code:Dim dbs As Database
' the True argument below opens the DB in EXCLUSIVE
' mode, required for setting password
Set dbs = OpenDatabase("C:\Whatever\MyData.mdb", True)
dbs.NewPassword = "", "topsecret"
dbs.Close
Here's to code to CHANGE the password from VB:Code:Dim dbs As Database
Set dbs = OpenDatabase("C:\Whatever\MyData.mdb", _
False, False, ";pwd=topsecret")
Here's to code to UNSET the password from VB:Code:Dim dbs As Database
Set dbs = OpenDatabase("C:\Whatever\MyData.mdb", _
True, False, ";pwd=topsecret")
dbs.NewPassword = "topsecret", "ultrasecret"
dbs.Close
enjoy!Code:Dim dbs As Database
Set dbs = OpenDatabase("C:\Whatever\MyData.mdb", _
True, False, ";pwd=ultrasecret")
dbs.NewPassword = "ultrasecret", ""
dbs.Close
Thank you very very much. :D
:p Kinjal :p