如何使用报告作为附件发送电子邮件 [英] How to send email with a report as an attachment

查看:156
本文介绍了如何使用报告作为附件发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一份报告。我有一个按钮。我想要的是:当用户点击按钮时,报告将被发送给某个收件人。我搜索了整个网络,包括这个论坛,这个网站
http://www.granite.ab.ca/access/emai...ttachments.htm

但我仍然不知道如何做到这一点以及是否它可以完成!..

我看到每个人都建议将报告转换成pdf文件。但命令SendObject不能发送pdf文件,可以吗?所以即使我要创建一个pdf,我怎么会发送它?


PS:即使创建pdf也行不通,我正在运行这一行:

DoCmd.OutputTo acOutputReport,rptEventProtocole,acFormatPDF ,,False(或True,没有改变任何东西)

access提示我输出格式,PDF不是列表中的选项之一。

I have a report. I have a button. What i want is: when user clicks the button, the report gets sent to some recipient. I searched all over the net, including this forum, and this site
http://www.granite.ab.ca/access/emai...ttachments.htm,
but i still have no idea how to do this and whether it can be done at all!..
I saw that everyone recommends to turn the report into a pdf file. But the command SendObject can''t send a pdf file, can it? So even if i would create a pdf, how would i then send it?

P.S: Even creating pdf doesn''t work, I''m running this line:
DoCmd.OutputTo acOutputReport, "rptEventProtocole", acFormatPDF, , False(or True, doesn''t change anything)
access prompts me for an output format, and PDF is not one of the options in the list.

推荐答案

@TravelingCat


您好


如果您使用的是Access 2000,那么我的建议在这个页面上看看Stephen Lebans网站

http://www.lebans.com/reporttopdf.htm


Stephen已正式退出Access,但他多年来为Access社区做出的出色贡献有所帮助很多人。我知道他对PDF输出报告的贡献是一个很大的贡献,依赖于他创建的几个DLL,这些DLL被转储到与mdb文件相同的文件夹中。不要指望对此有任何支持。考虑到他的退休生活,但是如果要让你过去直到升级,那么这是一种简单易用的方法。


首先从基于报告的对象创建PDF,然后当您了解PDF创建方面如何工作时,可以处理电子邮件事件
@TravelingCat
Hi

If you are using Access 2000 then my advice to you is to have a look at Stephen Lebans site at this page

http://www.lebans.com/reporttopdf.htm

Stephen has officially retired from Access but his wonderful efforts over the years to the Access community has helped many people. I for one know his contribution to output a report to PDF was a great contribution relying on a couple of DLLs he created that are dumped in the same folder as your mdb file. Don''t expect any support on this. given his retirement, but if it is to tide you over until you upgrade then it is an easy method to employ.

Get your head around creating the PDFs from report based objects first, then the email thing can be dealt with when you understand how the PDF creation aspect works


谢谢,但我已经从这个站点下载了mdb,但是有太多的代码我不知道甚至不明白......我想知道我是否真的需要这一切。我正在使用Access 2003.我不明白,为什么要做同样的事情 - 创建一个pdf - 一个站点有一个完整的mdb,另一行代码?...

DoCmd.OutputTo acOutputReport,MDB中的报告名称,acFormatPDF,路径/硬盘驱动器上的报告名称,错误

为什么这行不适用于我?

我仍​​然想知道是否可以通过访问发送pdf

我现在非常沮丧,将会感激任何帮助..
Thanks, but i already downloaded the mdb from this site, but there''s so much code which i don''t even understand... i wonder if i really need all this. And i''m using access 2003. I don''t understand, why for doing the same thing - creating a pdf - one site has a whole mdb, and the other one line of code?..
DoCmd.OutputTo acOutputReport, "Name of Report in MDB", acFormatPDF, "Path/Name of report on hard drive", False
And why doesn''t this line work for me?
And i would still like to know whether sending pdf via access is possible
I''m pretty frustrated by now, will appreciate any help..


@TravelingCat


您从哪里获得对acFormatPDF的引用?当我提到创建PDF时,我确实说过Access 2000,当你说PDF格式是你的可用选项时,我会用你的输出格式来总结这个。


Access 2000和Access 2003都本地发送这些格式只有Access 2007才能这样做。 Access的早期版本中的解决方法是要么购买一块第三方软件来完成这项工作,要么选择我已经说过的Stephens免费产品并完全按照它在锡上所说的那样做......可以这么说。


Stephen Lebans方法将保存到磁盘的访问报告转换为快照文件,并将其转换为PDF作为动态创建的外部文件,作为其中的一部分处理。这是新创建的PDF文件的路径,你必须选择并附加到任何电子邮件消息。


就像我之前说的那样我害怕说它是鸡肉和鸡蛋。如果你想实现你的目标,必须首先知道如何实现Stephens方法的步骤.........抓住外部文件以附加到电子邮件消息简单有点相关和有据可查,有很多参考资料如何在这里使用办公自动化。


我不是说一分钟理解这个过程是一件容易的事,但它为了实现你的目的是必要的,我担心,这可能是令人沮丧的:)
@TravelingCat
Where did you get your reference to acFormatPDF? I did say Access 2000 when I referred to creating a PDF I summized this when you said PDF format was not an available option to you, in your output formats.

Both Access 2000 and Access 2003 do not send in these formats natively only Access 2007 does that. The workaround in the earlier versions of Access was to either buy a piece of third party software to do the job or pick up on Stephens free offering which I already said works and does exactly what it says on the tin...so to speak.

Stephen Lebans method converts an access report saved to disk as a snapshot file and converts it to PDF as an external file created on the fly as part of that process. It is this path of the newly created PDF file that you must pick up on and attach to any email message .

Like I said before I am afraid to say it is chicken and egg. If you want to achieve your aim the steps are necessary to first know how to implement Stephens method.........the grabbing of the external file to attach to an email message is the easy bit comparatively and well documented, with plenty of references of how to do that on here using office automation.

I am not saying for one minute that understanding this process is an easy task but it is necessary in order to achieve your ends I am afraid, as frustrating as that may be :)


这篇关于如何使用报告作为附件发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆