I spent an unusually long time looking for this on the forums. The only responses I found were vague, incomplete, had errors in the snippet, or just plain didn't work. I wanted to post this to maybe keep someone else from having to navigate through all that. One posting came close, but had some typos. I forget the post or the poster, but this is based on his method and it works:
VB Code:
Public Sub ChangePassword(fileName As String, older As String, newer As String) Dim CGPconn As New ADODB.Connection Dim strsql As String CGPconn.Mode = adModeShareExclusive CGPconn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ fileName & ";Jet OLEDB:Database Password=" & older strsql = "Alter Database Password " & newer & " " & older CGPconn.Execute (strsql) Set CGPconn = Nothing End Sub
You do, of course, need to set a reference to Microsoft Active X Data Objects




Reply With Quote