Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    tcheck is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    131

    Access database fails when using Task Schedular

    I have an Access database that sends an email to users when there is an exception in the query. It works fine when I run it from Windows 7, but when I use task schedular I get an error message;



    runtime error 429 activex component can't create object

    and the error stops a;

    Set olapp = New Outlook.Application

    It only happens when i run it from Task Schedular.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    How does Task Scheduler do this - it opens the Access db?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    tcheck is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    131
    Yes. The database opens and I have a form that runs On Load and the script in in there.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Could you describe exactly how you set up the task to directly open the specific database?. It is something I tried to do a long time ago and abandoned. If I can replicate the scheduled task I can then test the email procedure.

    What I have in place is Scheduled Task to run a VBScript that opens the database and code behind default form sends email. Works great.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    tcheck is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    131
    It runs a batch file to open that Access Database. Her is what is in the batch file;

    "C:\Program Files (x86)\Microsoft Office\Office14\msaccess.exe" "J:\operations\FTP\AuditTrail\AuditTrailAlerts.acc db"

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Okay, then you are doing the same thing I am. No idea why it fails for you. Would have to test the db. Here is my VBScript code (Access 2007 under WindowsXP):

    Dim objFSO, oShell
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    'open the Access file
    Set oShell = CreateObject("WScript.Shell")
    oShell.Run """C:\Program Files\Microsoft Office\Office12\msaccess.exe"" ""\\dotatufs02\CRM\Lab\Database\Program\Editing\Ma terialsDatabase.accdb"""
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    tcheck is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    131
    It's odd that it only happens when run from Task Manager.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I can't replicate the issue. Mine works just fine.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Is the PC logged in when the code runs from Task Scheduler (TS)? I have automated email code run from TS and it works fine. Mine is logged in but locked at the time it runs.

    I use late binding, but I can't imagine that would matter. I also run the db directly from TS without a batch file, but as I recall I had trouble with accdb format so made mine an mdb.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Paul, what is the structure of the command strings in the Scheduler that work for you without script file? I have tried for both mdb and accdb. Nothing happens. The file doesn't open.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Is this what you're after (should have clarified my PC is Win 7 Pro 64 bit)?

    Click image for larger version. 

Name:	Task.jpg 
Views:	22 
Size:	90.9 KB 
ID:	12169
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Looks like the Scheduled Task utility has changed significantly with Windows7 'cause not seeing that with WindowsXP. I will have to test with Windows7. Thank you, Paul.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No problem. I remember really wrestling with it and could not get an accdb to run, but had no problem with the mdb.

    On a side note, I have a PC I remote to in Las Vegas that is Win XP Pro and I have several mdb's running directly from Scheduled Tasks there (numerous automated imports, but also an email sending app). Not sure why you had to use batch file to run, as the path in "Run" is similar.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #14
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Finally figured it out. I needed some more quote marks. Doh! Only took 3 years. Works with the accdb. Now to go test Windows7.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #15
    tcheck is offline Competent Performer
    Windows 7 Access 2007
    Join Date
    Nov 2010
    Posts
    131
    When I run the Access command directly from TS in W7 it states that it's running but nothing happens (Access does not open) that is why I had to create the batch file.

    Is there a differnent command that I shoudl use instead of the Set olapp = New Outlook.Application where it hangs in the TS task?

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access fails export query to XML
    By vinz in forum Access
    Replies: 1
    Last Post: 09-16-2014, 07:31 AM
  2. Replies: 0
    Last Post: 06-19-2012, 05:20 AM
  3. Help with Table Design for Employee Task Database
    By shelbsassy in forum Database Design
    Replies: 6
    Last Post: 04-08-2011, 05:14 PM
  4. Update Outlook task from Access
    By timg147 in forum Programming
    Replies: 1
    Last Post: 08-16-2010, 12:27 PM
  5. Add task from Access to Outlook
    By Johan in forum Programming
    Replies: 1
    Last Post: 03-31-2010, 09:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums