用于从报告向多人发送电子邮件的命令按钮。 [英] Command Button to Send E-mail to multiple people from report.

查看:103
本文介绍了用于从报告向多人发送电子邮件的命令按钮。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我们有一个跟踪承包商的数据库。我们使用数据库根据位置和其他信息查找承包商。


当您想要找到承包商时,您可以在搜索表单中输入州和城市等信息,然后单击按钮运行报告显示符合您在搜索表单上输入的标准的所有承包商。


该报告包含大量信息,其中一个是承包商的电子邮件地址。有时我们希望向报告中列出的所有承包商发送电子邮件。


我们想要做的是在报告标题上有一个命令按钮,它只是允许我们点击它然后打开一个新的电子邮件并自动填充包含所有地址的To框。


我写了这个简单的一点代码,但当你点击它时,它打开Outlook并创建新电子邮件,但仅包括报告中显示的第一条记录的电子邮件地址。报告中包含其电子邮件地址的字段称为Con_E-mail_Address

< span class =codeLinkonclick =Blur(this,this.parentNode.parentNode,getChildren(this),true);>展开 | 选择 | Wrap | 行号

解决方案

使用自动化代码可以很容易地实现这一点,如下所示:

  1. 按照指示在报表头上创建一个命令按钮。
  2. 设置对Microsoft Outlook XX.X对象库的引用。
  3. 将以下代码放在报表头的Click()事件中。该代码将:

    1. 打开一个记录集,该记录集基于QryContractors_BySearch,报告的记录源。
    2. 循环通过所有承包商E -Mail Addressess构建TO:String(确定[Contractors]字段名称]。
    3. 通过Automation打开Outlook并插入必要的值,包括TO:String。
    4. 等待您单击发送按钮。

    ''必须设置对Microsoft Outlook X.XX对象库的引用

    展开 | 选择 | 换行 | 行号


AD ezii的方法具有更大的灵活性,并避免了sendobject方法的一些限制(一个使得备注字段被截断为255个字符);但是,对于简单的报告,它是一个sendobject方法的简单方法,非常容易使用。

DoCmd.SendObject方法(Access / Office 2010)您将构建一个包含成员电子邮件地址的字符串需要发送电子邮件。

您可以将报告添加为附件。我建议您使用ACC2007-w / servicepak或ACC2010或更新版本的PDF格式,因为PDF格式是原生格式并保留报告格式。


mjtrike97:恭敬地,我们这样做通常每个线程处理一个问题/主题;然而,在这种情况下,两者是如此密切相关,答案是相同的。 (^ _ ^)


我认为这个想法只是向报告中指定的那些承包商发送电子邮件,而不是实际的报告本身。


该报告包含大量信息,其中一个是承包商的电子邮件地址。有时,我们希望向报告中列出的所有承包商发送电子邮件。



我认为承包商不会对他们的反对派的电子邮件收件人感兴趣,但事后看来,我可能误读了这个问题。这不是第一次,肯定不是最后一次! (LOL)。


Hello,

We have a database that keeps track of contractors. We use the DB to find contractors based on location and other information.

When you want to find contractors you enter information such as state and city in a search form click a button which runs a report that displays all contractors meeting the criteria you entered on the search form.

The report includes a bunch of information and one of them is the contractors e-mail addresses. Sometimes we want to send an e-mail to all those contractors listed on the report.

What we would like to do is have a command button on the report header that would simply allow us to click it and it open an new e-mail and populate the To box with all of their addresses automatically.

I wrote this simple little bit of code but when you click it, it opens outlook and creates a new e-mail but only includes the e-mail address of the first record displayed on the report. The field on the report that contains their e-mail address is called "Con_E-mail_Address"

Expand|Select|Wrap|Line Numbers

解决方案

This can be accomplished rather easily with Automation Code, as in:

  1. Create a Command Button on the Report Header as indicated.
  2. Set a Reference to the Microsoft Outlook XX.X Object Library.
  3. Place the following Code in the Click() Event of the Report Header. The Code will:

    1. Open a Recordset vased on QryContractors_BySearch, the Record Source of the Report.
    2. Loop thru all the Contractors E-Mail Addressess building a TO: String (assums a [Contractors] Field Name].
    3. Open Outlook via Automation and plug in the necessary Values including the TO: String.
    4. Wait for you to Click the Send Button.

    ''Must set a Reference to the Microsoft Outlook X.XX Object Library

    Expand|Select|Wrap|Line Numbers


ADezii''s method has greater flexibilty and avoids some limitations that the sendobject method has (one such that Memo Fields are truncated at 255 characters); however, for simple reports, it is a the sendobject method simple method and very easily used.

DoCmd.SendObject Method (Access/Office 2010) You would build a string that contains the email addresses of the members you needed to send the email.
You would add the report as an attachment. I would recommend that it be the PDF format provided you are using ACC2007-w/servicepak or ACC2010 or newer as the PDF format is native and retains the report formating.

mjtrike97: Respectfully, we do as that normally each thread handle a single question/topic; however, in this casem the two are so closely related the answer is the same. (^_^)


I thought that the idea was to Send an E-Mail to only those Contractors specified in the Report, and not the actual Report itself.

The report includes a bunch of information and one of them is the contractors e-mail addresses. Sometimes we want to send an e-mail to all those contractors listed on the report.

I figured that Contractors would not be interested in their opposition''s E-Mail Addressess, but in hindsight, I could have misread the question. It wouldn''t be the first time, and surely not the last! (LOL).


这篇关于用于从报告向多人发送电子邮件的命令按钮。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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