在邮件正文中附加访问表单和子表单数据

编程入门 行业动态 更新时间:2024-10-11 09:20:30
本文介绍了在邮件正文中附加访问表单和子表单数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

提前感谢:),我试图在邮件正文中附加子表单的数据。

Thanks in advance :), I am trying to attach the data of subform also in mail body.

当前状态:我可以附加主表格数据和生成邮件但无法附加子表单的数据,因为它只包含第一行,Tryied通过子窗体执行查询,但无法成功。我更喜欢通过子表单来实现。子窗体的名称为:subUpdateOrder。 VB代码:

Current Status: I am able to attach Main forms data and generate mail but unable to attach subform's data as it only includes the first row, Tryied doing it through Subform and query both but no success. I will prefer to do it by subform itself. Subform's Name is : "subUpdateOrder". VB Code:

Private Sub InformCustomer_Click() On Error GoTo Err_InformCustomer_Click Dim CustName As String ' Customer Name Dim varTo As Variant '-- Address for SendObject Dim stText As String '-- E-mail text Dim DelDate As Variant '-- Rec date for e-mail text Dim stSubject As String '-- Subject line of e-mail Dim stOrderID As String '-- The Order ID from form Dim detailQry As String 'Dim stHelpDesk As String '-- Person who assigned ticket 'Dim strSQL As String '-- Create SQL update statement 'Dim errLoop As Error CstName = Me![CustName] varTo = Me![CustEmail] stSubject = ":: Update - Oder Status ::" stOrderID = Me.[OdrID] DelDate = Me.[OdrDeliveryDate] stText = "Dear" & CstName & _ "You have been assigned a new ticket." & Chr$(13) & Chr$(13) & _ "Order Number: " & stOrderID & Chr$(13) & _ "Please refer to your order status " & Chr$(13) & _ "Exp Delevery Date: " & DelDate & Chr$(13) & Chr$(13) & _ dQuery & Chr$(13) & _ "This is an automated message. Please do not respond to this e-mail." 'Write the e-mail content for sending to assignee DoCmd.SendObject , , acFormatTXT, varTo, , , stSubject, stText, True Err_InformCustomer_Click: MsgBox Err.Description End Sub

Form Img: Form和Command1按钮运行代码

Form Img: Form and Command1 button to run the code

推荐答案

它会像(在 CstName = Me![CustName] 之前插入):

It would be something like (to insert before CstName = Me![CustName]):

Dim dQuery As String Dim rs As DAO.Recordset Set rs = Me!NameOfYourSubformCONTROL.Form.RecordsetClone While Not rs.EOF dQuery = dQuery & rs![Brand Name].Value & vbTab & rs![Model Name].Value & vbTab & rs![Color].Value & vbCrLF Wend Set rs = Nothing

更多推荐

在邮件正文中附加访问表单和子表单数据

本文发布于:2023-10-12 05:06:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1483795.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   文中   邮件   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!