Task Scheduler not running MS Access fully (1 Viewer)

Kayleigh

Member
Local time
Today, 09:48
Joined
Sep 24, 2020
Messages
706
I have this issue where I have scheduled via Windows Task Scheduler to run a MS Access file once a day which triggers a couple of emails. The database works fine when opened by a user HOWEVER when the triggered it will open a locked file and nothing else happens. Also it isn't possible to close after so it seems to still be open in the background somewhere.
Any ideas what is going on here??

Ps. I have scheduled other databases on other PCs through the Task Scheduler with NO such issues happening.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 04:48
Joined
Feb 19, 2002
Messages
43,275
This automatic process should be opening its own private copy of the FE so it does not interfere with anyone using the FE when the task runs. I generally run my scripts on a stand alone PC and overnight so there is no conflict with active users so I've never run into this.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 03:48
Joined
Feb 28, 2001
Messages
27,186
First question: Does the DB require a login? Because WTS won't supply one directly. If you need to define an account and password, you would have to build a batch file to run Access with a username and password in the file. And if you get your permissions by checking the domain, when you run from WTS you didn't come in through the domain so it doesn't know YOU.

Second question: When you run via WTS, by default you are running as SYSTEM. Have you tested whether that works for your app? Because believe it or not, it IS possible for certain file permissions to deny the correct access rights to SYSTEM account. Test it by manually running Access As System.

Third question: The most common method I've seen for doing this includes using the Access command-line /X:macro-name option to trigger a macro run that is independent of any opening macro you might have defined. The macro you specify (a) normally uses a RUN CODE action and calls a VBA function, though I suppose if your actions are available it could stay as a "pure" macro, but: (b) The triggered macro MUST end with an Application Quit action. Otherwise it will hang in the background. Sound familiar?

Fourth question: When you say "open a locked file" did you really mean a "lock" file - .LACCDB or .LDB as appropriate to the back-end data type?
 

Users who are viewing this thread

Top Bottom