Changing Database Password Programmatically

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
 
G

Graham R Seach

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
 

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