Full Version: How do I send text to email(but not as an attachment)?
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
jpred
Basically, I'd like to fill out a form's several memo and text fields, save it, click on a button and have the Label and associated information from the text / memo fields put into the body of an email, rather than attaching a report. I'd also like the email's 'To' and 'Subject' information to be automatically filled in.
Thanks!
freakazeud
Hi,
here is some working sample code which should help you further:

Dim strToWhom As String
Dim strMsgBody As String
Dim Fname As String
Dim Lname As String

Fname = Forms!frmQryDueRetest!EmployeFirstName
Lname = Forms!frmQryDueRetest!EmployeLastName

strToWhom = txtemailsupervisor.Value '<-- this is a field that holds an e-mail on the form or just use "email@e-mail.com"
strMsgBody = ("Mr/Ms " + [Lname] + ", " + [Fname] + " is due for tests!" & vbCrLf & "Your next line" & vbCrLf & vbCrLf & "two more lines down with more information in the body or whatever you want...")

DoCmd.SendObject , , , strToWhom, , , "WARNING! Someone is due for tests!", strMsgBody, True

HTH
Good luck
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.