Consulting

Results 1 to 2 of 2

Thread: Remove Access MDB Password But only simple pass .

  1. #1
    VBAX Mentor
    Joined
    Feb 2012
    Posts
    397
    Location

    Remove Access MDB Password But only simple pass .

    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

  2. #2
    Have you tried enclosing the password in delimiters? E.g.: 'password'
    codekabinett.com - Tips, tricks and code samples for Access & VBA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •