Removing a password that was created in a previous version from an Access 2007 databa

lowanam1

Registered User.
Local time
Today, 10:14
Joined
Jan 13, 2012
Messages
106
I am a newbie and need help removing a password. This link explains my exact problem. I have entered and changed the code as stated however it does nothing...Any help??? Thanks

http://vajentic.blogspot.com/2008/08/removing-password-that-was-created-in.html

Here is my version:

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, LOCK is the old password, and I am wanting to set the password to NULL
strAlterPassword = "ALTER DATABASE PASSWORD NULL [LOCK];"

' 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") = "LOCK"
'The following specifies the location of the database of which PW I'm trying to change.
.Open "Data Source= C:\Users\lowana.hernandez\Desktop\SCG 9-30-13 (2).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
 
Have you tried passing all the database details in your connection string?

So you have something like

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccessFile.accdb;
Persist Security Info=False;


and then you can use the execute statement on this?
 
Sorry I dont know what that means? Can you ask in a simplier way? :( This code was built by somebody else... Thanks for you help
 

Users who are viewing this thread

Back
Top Bottom