From: White Horse on
I want to nightly run a VBS Script in Scheduled tasks to open an
Access 2003 database and execute a macro.

The problem is that the database opens to a switchboard screen. I
need to open this database with a VBS script that mimicks opening the
database with {shift} open. My code:


dim accessApp
set accessApp = CreateObject("Access.Application")
accessApp.visible = True
accessApp.OpenCurrentDataBase("C:\ACF\Copied from Server\ACF.mdb")
accessApp.Run "Macro1"
accessApp.Quit


When this script executes, the switchboard is open, and the Macro1
can't be found (executed).


Thanks


From: JvC on
Set up a seperate application with the objects you need to run your macro.
Attach the tables you need in ACF.mdb
Give your new mdb an autoexec macro, with the following commands:
RunMacro with Macro 1 as the Macro name.
Quit

Set up the new mdb to run in Scheduled Tasks

John

"White Horse" <michael_13143(a)msn.com> wrote in message
news:47f791a3-53d7-4657-8be5-f8e46d2a9222(a)79g2000hsk.googlegroups.com...
>I want to nightly run a VBS Script in Scheduled tasks to open an
> Access 2003 database and execute a macro.
>
> The problem is that the database opens to a switchboard screen. I
> need to open this database with a VBS script that mimicks opening the
> database with {shift} open. My code:
>
>
> dim accessApp
> set accessApp = CreateObject("Access.Application")
> accessApp.visible = True
> accessApp.OpenCurrentDataBase("C:\ACF\Copied from Server\ACF.mdb")
> accessApp.Run "Macro1"
> accessApp.Quit
>
>
> When this script executes, the switchboard is open, and the Macro1
> can't be found (executed).
>
>
> Thanks
>
>


From: Albert D. Kallal on
As the other poster suggested, simply setup another mdb file with linked
tables to the application, and then you good to go. Place you code in a
standard module, and then your run command will execute that code (your
script looks just fine).


--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal(a)msn.com


From: White Horse on
Thanks for the input.

I believe this would be a good solution, but unfortunately, I can't
change the original ACF.mdb database (admin permissions that have
nothing to do with Access databases). I am permitted to "go through
the backdoor" by pressing the shift key before clicking open. I tried
Sendkeys "+", but this did not work.

I do a great amount of VBA from Excel dealing with Access databases,
but I couldn't do anything from there, either.

Mike