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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run a macro on password pretected DB

Status
Not open for further replies.

Emblem1

Technical User
Jan 11, 2007
77
US
I am trying to run a macro on my DB which is password protected with Windows Scheduled Tasks.

Access version 2003

DB Location "\\s02\s02usr\Traffic_Signal_Database\Traffic Signal Database 2003.mdb"

DB Password - newton

I want to run a macro in the Access DB called mcrEmailWeekly in windows scheduled tasks with a .vbs file. I get a compilation error when I try to run the macro. Here is the script.

"C:\Program Files\Microsoft Office\Office11\msaccess.exe" "\\s02\s02usr\Traffic_Signal_Database\Traffic Signal Database 2003.mdb" " /pwd newton /x EmailWeelky

Not sure what to change and have been digging thru MS and the 'net.

Thanks.
 
Code:
"C:\Program Files\Microsoft Office\Office11\msaccess.exe" "\\s02\s02usr\Traffic_Signal_Database\Traffic Signal Database 2003.mdb" /pwd "newton" /x "EmailWeelky"

That 's one line
 
Thanks for the reply. I came up with this late yesterday afternoon. It's a .vbs file that you call with scheduled tasks. Here is the code in case someone in the future finds it useful.



Option Explicit

dim aApp

set aApp=wscript.createobject("Access.Application")
Aapp.visible=true
aApp.opencurrentdatabase "\\server\share\databasename.mdb",,"databasepassword"
aApp.docmd.runmacro "macroname"

aApp.CloseCurrentDatabase


This will open the DB with the password, run the macro, and then close the DB.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top