I am on the right track here, however i can't get the database to open exclusively to allow password changes.
can any point in the right direction?
thanks!
Mr. Steve
can any point in the right direction?
Code:
On Error GoTo errorhandler
Dim strDbName As String
Dim strOLDDB As String
Dim strNewDb As String
Dim y As Integer
Dim acc As New Access.Application
Dim db As DAO.Database
strDbName = Dir(oldDbPath & "\*.MDB") ' Retrieve the first MDB file entry.
'Loop though the files in the folder to find MDB files.
Do While strDbName <> ""
' Ignore the current folder and the encompassing folder.
If strDbName <> "." And strDbName <> ".." Then
If Right(strDbName, 3) = "mdb" Then
Set acc = New Access.Application
acc.Visible = False
Set db = acc.DBEngine.OpenDatabase(oldDbPath & "\" & strDbName, False, False, "MS ACCESS;PWD=level1") '
'Error message for previous line: -2147221163 Method 'DBEngine' of object '_Application' failed
acc.OpenCurrentDatabase oldDbPath & "\" & strDbName, True, "level1"
'should open exlusively, but doesn't... (path, exclusive, bstrPassword)
CurrentDb.NewPassword "level1", "" 'change database password. can't unless db opened as exclusive.
CurrentDb.Close
Set acc = Nothing
acc.Quit
End If
End If
strDbName = Dir ' Get next MDB.
Loop
MsgBox "errors: " & y
Exit Sub
errorhandler:
Call writeError(strDbName, Err.Number, Err.Description)
y = y + 1
Resume Next
thanks!
Mr. Steve