从Access电子邮件发送PDF [英] Emailing PDF from Access

查看:802
本文介绍了从Access电子邮件发送PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚codeD后面的命令按钮发送表单的电子邮件,但邮件弹出,我打开PDF文件有相同的形式的15副本。是否有人知道为什么会是这样吗?

感谢:)

 对错误转到errhandle
DoCmd.SendObject acSendForm,frmETIC,acFormatPDF,电子邮件地址,,,恢复报告,附件是所提交的恢复报告
exitErr:
退出小组
errhandle:
如果Err.Number的<> 2501然后
MSGBOX(邮件取消了!)
结束如果
简历exitErr


Me.Filter =的currentdate =#与&我的currentdate&放!; #和探索='&放大器;我发现和放!; ',而龙尾='&放大器; !我的尾巴和放大器; '与FleetID ='与&我FleetID&放!; '
 

解决方案

这听起来像你的形式目前有15个记录。当您使用使用SendObject窗体上,它打印的所有的形式记录,而不仅仅是当前的,到PDF。我认为你需要筛选的形式,只显示当前记录,然后使用SendObject。如果您的数据源有一个名为一个主键字段 ID 用途:

  Me.Filter =ID =&放大器;我!ID
Me.FilterOn = TRUE
DoCmd.SendObject acSendForm,frmETIC,...
 

如果你有一个多字段主键的使用:

  Me.Filter =ID =&放大器;我的ID及放!; AND的CustName ='&放大器;我的CustName&放!; '
Me.FilterOn = TRUE
 

使用没有分隔符的数字字段,报价围绕文本字段值,而各地日期字段值格式MM / DD / YYYY。

I have just recently coded behind a command button to send an email of a form, but when the email pops up and I open the PDF file there are 15 duplicates of the same form. Does anybody know why this would be happening?

Thanks :)

On Error GoTo errhandle
DoCmd.SendObject acSendForm, "frmETIC", acFormatPDF, "email address", "", "", "Recovery Report", "Attached is the submitted Recovery Report"
exitErr:
Exit Sub
errhandle:
If Err.Number <> 2501 Then
MsgBox ("Email cancelled!")
End If
Resume exitErr


Me.Filter = "CurrentDate= #" & Me!CurrentDate & "#" AND "Discover= '" & Me!Discover & "'" AND "Tail= '" & Me!Tail & "'" AND "FleetID= '" & Me!FleetID & "'"

解决方案

It sounds like your form currently has 15 records. When you use SendObject on a form, it prints all records in the form, not just the current one, into the PDF. I think you need to filter your form to show only the current record, then SendObject. If your data source has a primary key field named ID use:

Me.Filter = "ID=" & Me!ID
Me.FilterOn = True
DoCmd.SendObject acSendForm, "frmETIC", ...

If you have a multi-field primary key use:

Me.Filter = "ID=" & Me!ID & " AND CustName = '" & Me!CustName & "'"
Me.FilterOn = True

Use no delimiter for numeric fields, quotes around text field values, and # around date field values formatted mm/dd/yyyy.

这篇关于从Access电子邮件发送PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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