Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Provider
Message
De
22/07/2013 16:35:53
 
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
Access
Titre:
Provider
Divers
Thread ID:
01579018
Message ID:
01579018
Vues:
40
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
Répondre
Fil
Voir

Click here to load this message in the networking platform