|
-
Aug 29th, 2005, 02:42 PM
#1
Thread Starter
PowerPoster
Changing an mdb password programatically: This snippet works
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
-
Aug 29th, 2005, 02:44 PM
#2
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|