few things you should be aware when you try to use VBA to Link or Connect to a password protected BE db.
1. Password can't be declared as string!!! It should be a variant (Or nothing at all)
2. Code that use password is very sensitive to extra spaces !!! Look carefully for any space before or after the password.
This will work:
This will not (Notice the extra spaces before or after the password):
1. Password can't be declared as string!!! It should be a variant (Or nothing at all)
2. Code that use password is very sensitive to extra spaces !!! Look carefully for any space before or after the password.
This will work:
Code:
tdf.Connect = "MS Access;PWD=" & FilePassword & ";DATABASE=" & FileName & ""
Set DB = OpenDatabase(FileName, False, False, "MS Access; PWD=" & FilePassword & "")
This will not (Notice the extra spaces before or after the password):
Code:
tdf.Connect = "MS Access;PWD=" & FilePassword & " ;DATABASE=" & FileName & ""
Set DB = OpenDatabase(FileName, False, False, "MS Access; PWD= " & FilePassword & " ")