Opening a Password Protected Access Database Using VBScript -
i have password protected access database needs updated overnight. have written lite java application takes parameters (i.e. macro, path, file type, etc) , executes vbscript through command line. have way "store" user name , password, , pass vbscript, far have not found other postings on resolves problem. here sample code of opening access db, macro, , need accept username , password.
set accdbobj = wscript.createobject("access.application") accdbobj.application.visible = true message = ("access password update started macro...") loginformation message, path accdatabase = accdbobj.opencurrentdatabase(path) accdbobj.run macro accdbobj.terminate wscript.quit
keep in mind path
, macro
parameters passed in string.
give opencurrentdatabase method database password third argument. however, opencurrentdatabase
doesn't return anything, don't think makes sense assign return value accdatabase
. try way instead:
accdbobj.opencurrentdatabase path, , "password_here"
there 2 types of passwords access db file.
- database password: 1 password users must supply open db
- user-level security password: separate password each defined user
i wrote first part of answer assuming meant database password. however, noticed mentioned user name, suggests may using uls (user-level security). uls supported in older mdb db file format. access 2007, may using newer accdb format not support uls.
if using mdb uls, you'll need different method open database. use dbengine.createworkspace uls user name , password , call opencurrentdatabase
within workspace.
Comments
Post a Comment