Cannot pass Parameters using OpenCurrentDatabase

T

ThomasAJ

I have tried all sorts of double and single quote combinations but no way can
I passcommand line parameters to the database being opened.

eg
Set accessApp = CreateObject("Access.Application")
accessApp.OpenCurrentDatabase ("""Path\Task.mdb"" /cmd ""Event1""")
OR
accessApp.OpenCurrentDatabase ("'Path\Task.mdb' /cmd 'Event1'")

I keep getting an error message that the MDB is missing.
 
C

Chris O'C via AccessMonster.com

Opencurrentdatabase doesn't allow command line arguments. Use shell function
instead. Look in Access help for the rules and examples.

Chris
 
T

ThomasAJ

Oh...I want to run my Access app via Task Scheduler but I could not manage to
pass command line paramteres there so I tried a VBSCRIPT using
OpenCurrentDatabase. It failed also so I tried to pass parameters using
OpenCurrentDatabase within another Access program to see if command line
parameters worked. Hence this question.

OK so how does one pass command line parameters when running an Access app
in Task Scheduler OR a VBSCRIPT?
 
C

Chris O'C via AccessMonster.com

Have you tried a shortcut? You have to put the complete paths to the files
and /cmd <value> must be the last argument.

"path to msaccess.exe" "path to db.mdb" /cmd Event1

Some versions of Access ignore the /cmd switch.

Chris
 
Top