Changing Database Password Programmatically

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have an Access database controlled through a VB6 app. There is a database
password set up, and database encryption is used. I need to be able to
change the database password through the VB6 app. I have found several
answers using the standard ADO, ADOX, and DAO, but none of them have worked
for me. Also, the Access Security FAQ from Microsoft does not have any
appropriate information on this.

Has anyone ever done this?

Thanks for any help!

John
 
John,

Public Sub ChangePassword(strUser As String, _
strOldPassword As String, strNewPassword As String)
Dim wrk As DAO.Workspace
Dim usr As DAO.User

Set wrk = DBEngine(0)
Set usr = wrk.Users(strUser)

'Change the password
usr.NewPassword strOldPassword, strNewPassword

Set usr = Nothing
Set wrk = Nothing
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Back
Top