Results 1 to 5 of 5
  1. #1
    tez is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2012
    Posts
    3

    Running a query / macro through scheduled task

    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

  2. #2
    help_me_with_access is offline help_me_with_excel
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    262
    could it possibly be the fact that the acc file is linked to an xl b/e? i wonder if that might be the problem. not sure why it would be though...

  3. #3
    tez is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2012
    Posts
    3
    Not sure, I can schedule a Excel Macro fine, just not a Access one

  4. #4
    help_me_with_access is offline help_me_with_excel
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    262
    what method you using for excel?

  5. #5
    tez is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2012
    Posts
    3
    For excel, im running a vb script to call on a macro in the spreadsheet. This works fine.

    For access I tried calling a macro through vb script and it just stalled. Same with using the command line /x macroname.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. running macro in another DB
    By AdrianoG87 in forum Import/Export Data
    Replies: 1
    Last Post: 09-30-2011, 12:31 AM
  2. Running an Update Query from a Macro
    By michaelb in forum Queries
    Replies: 7
    Last Post: 06-02-2011, 09:46 PM
  3. Scheduled run of Compact-Repair off hours
    By techexpressinc in forum Access
    Replies: 1
    Last Post: 05-25-2011, 11:08 AM
  4. Running a VB function in a Macro
    By JuuJuu in forum Access
    Replies: 1
    Last Post: 10-27-2009, 02:50 AM
  5. Replies: 2
    Last Post: 09-30-2009, 09:40 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