Automatically Email Reports From Access

耗尽温柔 提交于 2019-12-02 11:43:18

I would personally suggest using the MS Access Macro to solely perform the emailing operation (either using the EmailDatabaseObject action, SendObject method of the DoCmd object in VBA, or by automating the installed email client using ActiveX in VBA).

You can then use Windows Task Scheduler to invoke the MS Access Macro at a given time or on a given schedule.

To create a Scheduled Task to invoke an MS Access Macro, perform the following steps:

  • Open Task Scheduler in Windows either through the Start Menu or by running taskschd.msc
  • Select the Task Scheduler Library from the left-hand pane (or create your own folder beneath this)
  • From the right-hand Actions pane, select Create Task
  • Populate the obvious options such as the Name, Description, etc. as appropriate.
  • Add a Trigger based on the time/schedule on which you wish to run the macro.
  • Add an Action and select Start a Program
  • Browse to the location of and select the MSACCESS.exe executable.
  • In the Add arguments edit box, specify the filepath to your database (enclosed in double quotes if the path contains any spaces), followed by the /x command-line switch and the name of your macro, e.g.:

    "C:\Your Folder\Your Database.accdb" /x YourMacro
    

    Or, if you have a SubMacro within the Macro:

    "C:\Your Folder\Your Database.accdb" /x YourMacro.YourSubMacro
    

    You can find out more about the available command-line switches for MS Access here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!