PDA

View Full Version : Remove Access MDB Password But only simple pass .



parscon
08-29-2019, 03:34 AM
Hi I have vbs that it works with the DB password set to aaaa. But it doesn't work with a strong password, like 5wNKc7if/b5JZ1
Can you help me on this ?



If WScript.Arguments.Count<2 Then
WScript.Echo "Usage: "&WScript.ScriptName & " <folderpath> <password>"
WScript.Quit(0)
End If
fldr = WScript.Arguments(0)
pwd = WScript.Arguments(1)

Set cn = CreateObject("ADODB.Connection")
Set fso = CreateObject("Scripting.FileSystemObject")

Set f = fso.GetFolder(fldr)
Set fc = f.Files

For Each f1 in fc

If Right(UCase(f1.Name),4)=".MDB" Then
With cn
.Provider = "Microsoft Jet 4.0 OLE DB Provider"
.Mode = 12
.Properties("Data Source").Value = f1.Path
.Properties("Jet OLEDB:Database Password").Value = pwd
.Open
End With
SQL = "ALTER DATABASE PASSWORD NULL " & pwd
cn.Execute SQL
cn.Close

End If
Next

Set cn = Nothing

PhilS
09-26-2019, 01:33 AM
Have you tried enclosing the password in delimiters? E.g.: 'password'