Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Provider
Message
From
22/07/2013 16:35:53
 
 
To
All
General information
Forum:
Visual Basic
Category:
Access
Title:
Provider
Miscellaneous
Thread ID:
01579018
Message ID:
01579018
Views:
39
I found this code on the Internet, but it was written for Access 2007. How do I update for Access 2010?
Public Sub ChangeDBPassword()
Dim objConn As ADODB.Connection
Dim strAlterPassword As String

On Error GoTo ChangeDBPassword_Err

' Create the SQL string to change the database password.
' Here, KLAS is the old password, and I am wanting to set the password to NULL
strAlterPassword = "ALTER DATABASE PASSWORD NULL [His@rdut1];"

' Open the secured database.
Set objConn = New ADODB.Connection

With objConn
.Mode = adModeShareExclusive
'.Provider = "Microsoft.Jet.OLEDB.4.0"
'I had to update the Provider information for Access 2007, as the code was quite old.
.Provider = "Microsoft.ACE.OLEDB.12.0"
.Properties("Jet OLEDB:Database Password") = "His@rdut1"
'The following specifies the location of the database of which PW I'm trying to change.
.Open "Data Source= C:\Users\Nicole\Desktop\ONE OF A KIND REALTY\Cole Directory\ColeDirectory.accdb;"
' Execute the SQL statement to change the password.
.Execute (strAlterPassword)
End With

' Clean up objects.
objConn.Close
Set objConn = Nothing

ChangeDBPassword_Err:
MsgBox Err.Number & ":" & Err.Description
End Sub
Reply
Map
View

Click here to load this message in the networking platform