How can I schedule a Macro to run automatically in Access 2007

后端 未结 3 1126
轻奢々
轻奢々 2021-01-03 03:13

I\'d like to have a macro, called Macro1, for example, run every day at 9 AM. It works great on its own from the VB code editor in Access 2007 but I would like it to be able

3条回答
  •  长情又很酷
    2021-01-03 03:59

    You must create vbscript to run your macro and create a batch file to schedule your vbscript.

    • vbscript code, save this as schedule.vbs file

      Dim accessApp
      set accessApp = createObject("Access.Application") accessApp.OpenCurrentDataBase("fullpath\msaccessdb")

      accessApp.Run "Macroname",param1, param2,param3
      accessApp.Quit
      set accessApp = nothing

    • THEN create file.bat

      @echo off
      cscript schedule.vbs

    and your ready to schedule it using the windows task scheduler http://www.thewindowsclub.com/how-to-schedule-batch-file-run-automatically-windows-7

    hope this help :D

提交回复
热议问题