PDA

View Full Version : Email tied to Subform



FrymanTCU
04-29-2008, 11:07 AM
OK, thanks to OT Warrior, my email is sending quite nicely but I am sending the email from my main audit form but I want to loop through the data in the subform and send the information in the body of the email. Is there a way to export the subform data as a table in the email? I am not an expert at coding but any suggestions are greatly appreciated.
Thanks

Public Sub cmdEmail_click()
Dim GenEmail As NewEmail
GenEmail.To = ""
GenEmail.From = ""
GenEmail.Body = "<b>ATTENTION!</b>" & Chr$(11) & "" & Chr$(11) & "" & Trim(Me.[USER_NAME]) & "," & Chr$(11) & " " & Chr$(11) & "An internal audit of our records has discovered an unauthorized document status change in the CPS System. Please respond to this email with the business reasoning for the change and CC your manager for approval. If no response is given within 5 business days, the change will be reversed and your User Access will be reviewed by Data Security." & Chr$(11) & "" & Chr$(11) & "Thank you," & Chr$(11) & "" & Chr$(11) & "National New Accounts Audit"
GenEmail.Email_as_HTML = True ' False = Plain Text
GenEmail.Subject = "ACTION REQUIRED: UNAUTHORIZED DOCUMENT STATUS CHANGE"
GenEmail.View_Before_Send = True
GenEmail.High_Importance = True
Select Case Create_Email(GenEmail) ' Will return True if Done
Case True
MsgBox "Email Created", 64, ""
Case Else
MsgBox "Email Creation Failed", 16, ""
End Select
End Sub

OBP
05-02-2008, 03:59 AM
You can a recordset based on the subform to do this, or if the Subform is based on a query you could use an SQL recordset.