Question Running a query / macro through scheduled task

tez1

New member
Local time
Today, 11:24
Joined
Aug 26, 2012
Messages
1
Hi everyone,

I have a MS Access append query that updates a table from a linked Excel spreadsheet.
Im trying to automate the running of the query during the night.

Ive tried a couple of ways to schedule the task with Windows Task Scheduler, although each time, it appears to start the job, but then just hang (task never completes, doesnt run the query or macro and when I log back into Windows, the msaccess.exe process is running).

Methods Ive used are:

- command line with /x macroname

- vbs script which runs the query / macro

Code:
'Read from a Microsoft ACCESS database

Option Explicit

dim oaccess

'execute another Access macro
set oaccess = createobject("access.application")
oaccess.opencurrentdatabase "H:\Database.mdb"
oaccess.docmd.setwarnings false
oaccess.DoCmd.RunMacro "Macro1"
oaccess.docmd.setwarnings true
oaccess.closecurrentdatabase
oaccess.quit
set oaccess=nothing

WScript.Quit(0)
- .bat file which just has the command line in it.

They all run fine when I am logged in, although it seems to hang when I am logged off the network.
I have the correct permissions as Ive scheduled a Excel macro to run and its fine.

Any ideas? Thanks
 

Users who are viewing this thread

Back
Top Bottom