I'm having trouble running an Access macro on a password protected Access database. If I remove the password and use the following code everything works fine.
Dim ac As Access.Application
Set ac = New Access.Application
ac.OpenCurrentDatabase ".mdb", False
ac.Visible = False
ac.DoCmd.RunMacro "macroname"
ac.CloseCurrentdB
Set ac = Nothing
However, with the password enabled it won't run automatically. You need to type in the password manually.
I've tried using the OLEDB to access the database and provide a password:
Dim conn
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=.mdb; "
conn.Properties("Jet OLEDBatabase Password" = "pswd"
conn.Open conn.ConnectionString
This opens the database, but it expects SQL strings to fill in the information. I just want to call a macro. Can this be done on a pswd protected dB? Any help would be appreciated. Thanks in advance.
Dim ac As Access.Application
Set ac = New Access.Application
ac.OpenCurrentDatabase ".mdb", False
ac.Visible = False
ac.DoCmd.RunMacro "macroname"
ac.CloseCurrentdB
Set ac = Nothing
However, with the password enabled it won't run automatically. You need to type in the password manually.
I've tried using the OLEDB to access the database and provide a password:
Dim conn
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=.mdb; "
conn.Properties("Jet OLEDBatabase Password" = "pswd"
conn.Open conn.ConnectionString
This opens the database, but it expects SQL strings to fill in the information. I just want to call a macro. Can this be done on a pswd protected dB? Any help would be appreciated. Thanks in advance.