Changing a User Password : Database Password « Access « VBA / Excel / Access / Word






Changing a User Password

 
Sub Change_UserPassword()
    Dim cat As ADOX.Catalog
    Dim strDB As String
    Dim strSysDb As String

    On Error GoTo ErrorHandle

    strDB = CurrentProject.Path & "\mydb.mdb"

    strSysDb = "C:\System.mdw"

    Set cat = New ADOX.Catalog
    With cat
        .ActiveConnection = "Provider='Microsoft.Jet.OLEDB.4.0';" & _
                            "Data Source='" & strDB & "';" & _
                            "Jet OLEDB:System Database='" & strSysDb & "';" & _
                            "User Id=Admin;Password=;"
        .Users("Admin").ChangePassword " ", "secret"
    End With

ExitHere:
    Set cat = Nothing
    Exit Sub
ErrorHandle:
    MsgBox Err.Description
    GoTo ExitHere
End Sub

 








Related examples in the same category

1.Setting a Database Password
2.Setting a Database Password with SQL command
3.Deleting a Database Password with SQL command
4.Embedding a Database Password in Code
5.Requiring Password Validation