从表单数据撰写电子邮件 [英] composing an email from form data

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

问题描述

大家好,


我先解释一下我的数据库。


用户输入完成公司所需的客户详细信息

文件。文档合并等全部工作 - 数据库根据表单数据将完成的文档保存到变量目录。


我需要编写代码现在是一个创建电子邮件的按钮。

电子邮件每次都有相同的基本文本,但只需从表单中绘制一些

变量。


理想情况下 - 数据库也会收集数据库刚刚生成的

文档的附件(假设我可以硬编码

目录行&文件名基于表格中的变量

数据)


我不知道附件部分是否可行,如果不是,我可以生活

这个。


然而我真正需要的是至少能够编码

多行为电子邮件。


我尝试过使用DoCmd.SendObject acSendNoObject。但是我不知道如何将正文文本转换为多行格式。


发送对象适用于基本的文本字符串和主题行...


任何人都可以帮我编码吗?或者可能想出一个解决方案

已经过了?


干杯!

解决方案

DeZZar写道:


大家好,


我先解释一下我的数据库。


用户输入完成公司所需的客户详细信息

文件。文档合并等全部工作 - 数据库根据表单数据将完成的文档保存到变量目录。


我需要编写代码现在是一个创建电子邮件的按钮。

电子邮件每次都有相同的基本文本,但只需从表单中绘制一些

变量。


理想情况下 - 数据库也会收集数据库刚刚生成的

文档的附件(假设我可以硬编码

目录行&文件名基于表格中的变量

数据)


我不知道附件部分是否可行,如果不是,我可以生活

这个。


然而我真正需要的是至少能够编码

多行为电子邮件。


我尝试过使用DoCmd.SendObject acSendNoObject。但是我不知道如何将正文文本转换为多行格式。


发送对象适用于基本的文本字符串和主题行...


任何人都可以帮我编码吗?或者可能想出一个解决方案

已经过了?


干杯!



你不能通过电子邮件附上一份不是Access文件的文件

with SendObject。


我建议您从 http:/开始/www.granite.ab.ca/access/email.htm

电子邮件的一些帮助。


然后去 http://groups.google.com/advanced_search?q=&pli = 1 并搜索

发送电子邮件

和小组

comp.databases.ms-access

以获取更多代码示例。


没有办法简单地指示代码使用多行:


这是我目前的代码,如果只有一些

的方式来扩展它以使用多行,它将正常工作。


Private Sub Treasury_email_Click()


DoCmd.SendObject a cSendNoObject,email,acFormatTXT,AFS - Asset&

Liability Management,(Forms!frm_Leaselocks!BDM),, _

" RATE ACCEPTED - " &安培;表格!frm_Leaselocks!客户名称& " - C / N: &

表格!frm_Leaselocks!CustomerNumber,_

"<电子邮件的正文部分 - 只需多行>"

DeZZar写道:


没有办法简单地指示代码使用多行:


这是我当前的代码,如果只有一些

的方式来扩展它以使用多行,它将正常工作。


Private Sub Treasury_email_Click( )


DoCmd.SendObject acSendNoObject,email,acFormatTXT,AFS - Asset&

Liability Management,(Forms!frm_Leaselocks!BDM),,, _

接受的汇率 - &安培;表格!frm_Leaselocks!客户名称& " - C / N: &

表格!frm_Leaselocks!CustomerNumber,_

"<电子邮件的正文部分 - 只需多行>"



我可能会做类似的事情

Dim strBody As String

strBody =" Hello Joe" &安培; vbNewLine& 你今天过得怎么样? &安培; _

vbNewLine& vbNewLine& 你还投票了吗? &安培; vbNewLine& _

vbNewLine& 向妻子打个招呼。


然后在最后使用strBody而不是你的

"<电子邮件的正文部分 - 只需要多行>


Hi all,

I''ll explain my database first.

Users input customer details that are required to complete a company
document. The document merge etc is all working - the database saves
the completed document to a variable directory based on form data.

What I need to code into it now is a button that creates an email.
The email has the same basic text each time but just needs to draw a
few variables from the form.

Ideally - the database would also collect as an attachement the
document the database just produced (given that I could hard code the
directory line & document name based on the variables in the form
data)

I don''t know if the attachement part is possible and if not I can live
with this.

However the thing I really need is to be at least able to code
multiple lines for the email.

I have tried using "DoCmd.SendObject acSendNoObject" however I don''t
know how to get the body text into a multi line format.

Send object works for a basic string of text and a subject line...

Can anyone help me code this?? or has maybe come up with a solution
already??

Cheers!

解决方案

DeZZar wrote:

Hi all,

I''ll explain my database first.

Users input customer details that are required to complete a company
document. The document merge etc is all working - the database saves
the completed document to a variable directory based on form data.

What I need to code into it now is a button that creates an email.
The email has the same basic text each time but just needs to draw a
few variables from the form.

Ideally - the database would also collect as an attachement the
document the database just produced (given that I could hard code the
directory line & document name based on the variables in the form
data)

I don''t know if the attachement part is possible and if not I can live
with this.

However the thing I really need is to be at least able to code
multiple lines for the email.

I have tried using "DoCmd.SendObject acSendNoObject" however I don''t
know how to get the body text into a multi line format.

Send object works for a basic string of text and a subject line...

Can anyone help me code this?? or has maybe come up with a solution
already??

Cheers!

You can''t attach a document that isn''t an Access document via an email
with SendObject.

I recommend you start at http://www.granite.ab.ca/access/email.htm for
some help on emails.

Then go to http://groups.google.com/advanced_search?q=&pli=1 and search on
Sending Emails
and for the group
comp.databases.ms-access
for further code examples.


is there no way to simply instruct the code to use multiple lines:

This is my current code that would work fine if there was just some
way to expand it to use multiple lines.

Private Sub Treasury_email_Click()

DoCmd.SendObject acSendNoObject, email, acFormatTXT, "AFS - Asset &
Liability Management", (Forms!frm_Leaselocks!BDM), , _
"RATE ACCEPTED - " & Forms!frm_Leaselocks!CustomerName & " - C/N: " &
Forms!frm_Leaselocks!CustomerNumber, _
"<body text portion of the email - just need multiple lines>"


DeZZar wrote:

is there no way to simply instruct the code to use multiple lines:

This is my current code that would work fine if there was just some
way to expand it to use multiple lines.

Private Sub Treasury_email_Click()

DoCmd.SendObject acSendNoObject, email, acFormatTXT, "AFS - Asset &
Liability Management", (Forms!frm_Leaselocks!BDM), , _
"RATE ACCEPTED - " & Forms!frm_Leaselocks!CustomerName & " - C/N: " &
Forms!frm_Leaselocks!CustomerNumber, _
"<body text portion of the email - just need multiple lines>"

I might do something like
Dim strBody As String
strBody = "Hello Joe" & vbNewLine & "How are you doing today?" & _
vbNewLine & vbNewLine & "Have you voted yet?" & vbNewLine & _
vbNewLine & "Say hi to the wife."

Then at the end use strBody instead of your
"<body text portion of the email - just need multiple lines>"


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

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