?
Solved

Schedule WIndows 7 Task to run Access 2010 Macro

Posted on 2012-03-26
10
Medium Priority
?
8,353 Views
Last Modified: 2014-01-23
I am trying to run an Access 2010 module as a daily Scheduled Task on a Windows 7 Professional operating system.
This will run at night when my computer is logged off.  

I have the Action: Start a program
Settings
Program/script: "C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE"


Add Arguments (optional): "C:\Scripts\DailyReports.accdb" /x mcrEmailPOlines

Start in (optional): blank

I have this set to run whether user is logged on or not and to run with the highest privilages.  
It is configured for WIndows 7 and WIndows SErver 2008R2

It looks like the task kicks off, but the follow message shows for the Last Run Result

The task is currently running.  (0x41301)

This status will not change.  I eventually end the run.

After it tries to run, when I open Access, I get the message:
Access failed to start correctly last time.  Starting Access in safe mode will help you correct or isolate a startup porblem in order to successfully start the program.  SOme functionality may be disabled in this mode.   Do you want to start Access in safe mode.

I even tried to run a batch file to kick off the macro from Task Scheduler with similar results.  Double clicking the batch file works fine.  I just hang in Task Scheduler.

Any thoughts?
0
Comment
Question by:Scamquist
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 28

Expert Comment

by:Run5k
ID: 37768374
Try configuring the task to run with the built-in local System account.  That way, you can ensure it runs with the highest level of privileges.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37768385
This is the issue with trying to run Access database "unattended"

Any number of things can go wrong, so you *Must* have iron-clad Error handling and Roll-Backs in place in case something does.

In your case it may just be that the locking file: (.ldb, or .laccdb) was not deleted.
Back up the database first.
Then try locating this file when the DB is closed, ...if it exists, then delete it.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37768395
...Also make sure you open the DB manually every once in a while to do a Compact/Repair and compile the code ...

JeffCoachman
0
10 Questions to Ask when Buying Backup Software

Choosing the right backup solution for your organization can be a daunting task. To make the selection process easier, ask solution providers these 10 key questions.

 
LVL 61

Expert Comment

by:mbizup
ID: 37771587
Does your Access macro include a command to close the database when it is complete?
0
 
LVL 1

Author Comment

by:Scamquist
ID: 37772571
Sorry for the delay in replying.  
Run5K - tried as system - no difference.

Borag2000 - no locking file open

mbizup - the macro calles a function to email a spreadsheet.  The last command is to quit the application.

Still not working.  Trying to call a batch file to do the same thing.

Task Scheduler
Program/script:    cmd
Add Argurment: /c start "" "C:\Scripts\ExportPOLines.bat"

batch file contains:
@echo off
"C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE" "C:\Scripts\DailyReports.accdb" /x mcrEmailPOlines

Ran first time but not next.  Still playing.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 2000 total points
ID: 37772730
Why the need for a batch file?

Just do this for Run:
"C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE" "C:\Scripts\DailyReports.accdb" /x mcrEmailPOlines
0
 
LVL 1

Author Closing Comment

by:Scamquist
ID: 37783471
Thank you for the assist
0
 

Expert Comment

by:ldsdivine
ID: 39072031
This answer does not work for me. My process still does not run. I also have an ODBC connection in my Access database. Could that be causing a problem and if so, what do I need to do?
0
 

Expert Comment

by:Lou951
ID: 39803755
Have run into this same issue.  Command line execution of an Access macro fires with no issue and closes Access.  However, set this up in the Windows Task Scheduler and the Task Scheduler seems to hang until it times out at a predetermined limit of 2 hours.  Seems that there is an issue in Windows 7 Task Scheduler executing Access macros.  

Has anyone found a resolution to this problem?
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month8 days, 6 hours left to enroll

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question