Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

password protected dB - RunMacro

Status
Not open for further replies.

dlingo

Programmer
Nov 19, 2001
60
US
I am trying to run a Macro that is contained within a password protected database.
If I use the following code it works when the database password is removed, but for security reasons I do not want to remove the password.

Dim ac As Access.Application
Set ac = New Access.Application

ac.OpenCurrentDatabase ".mdb", False
ac.Visible = False
ac.DoCmd.RunMacro "MacroName"
ac.CloseCurrentDatabase

I've tried using the following code, but it's expecting an SQL string from here....

conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;DataSource=".mdb"; "
conn.Properties("Jet OLEDB:Database Password") = "pwd"
conn.Open conn.ConnectionString

What can I do to open that password protected database and run the macro within the database.

Any help would be appreciated. Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top