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

VB Automation of Access with Password

Status
Not open for further replies.

bkf7911

MIS
Mar 20, 2007
83
US
I'm using a scheduler to launch a .bat file that then triggers a .vbs file that launches an MS Access database and runs a macro. I need to add a password to the MS Access database and i need to modify the .vbs file to send the database password so that it will automatically login. I can get it going in a module, but not the.vbs file. The following is my code. What code can I add and where can I add it so that the password is sent at the appropriate time?
********************
dim o

set o=createobject("Access.Application")
o.automationsecurity=1
o.opencurrentdatabase "C:\DB_S.mdb"
o.usercontrol=true
o.docmd.runmacro "All_Auto"
o.CloseCurrentDatabase
o.Quit

set o=nothing
********************
 

1. faq222-2244

2. forum329

If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Thanks, but i figured it out on my own.

I replaced:

o.opencurrentdatabase "C:\DB_S.mdb"

with

o_OpenCurrentDatabase "C:\DB_S.mdb",,"password
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top