Send email

Eddy2010
Eddy2010 used Ask the Experts™
on
Hi I have the following codes to send email after choice is made yes, no. I would like to add from the form the following fields: name, Services date, typeID with thier lables. Any suggestions?

  Dim strSubject As String
  Dim Mymessage As String
  strSubject = "Service needed"


Mymessage = "Dear, " & vbCrLf
Mymessage = Mymessage & " " & vbCrLf
Mymessage = Mymessage & " " & vbCrL
Mymessage = Mymessage & "Please coordinate nessacery arrangement......" & vbCrLf
Mymessage = Mymessage & " " & vbCrLf
Mymessage = Mymessage & "Thanks." & vbCrLf

Mymessage = Me.Name
Mymessage = Me.ServiceDate
Mymessage = Me.TypeID

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
mbizupNerd
Most Valuable Expert 2012
Top Expert 2013

Commented:
Assuming that you are running this from a command button or other event on the same form, try this:

  Dim strSubject As String
  Dim Mymessage As String
  strSubject = "Service needed"


Mymessage = "Dear, " & vbCrLf
Mymessage = Mymessage & " " & vbCrLf
Mymessage = Mymessage & " " & vbCrL
Mymessage = Mymessage & "Please coordinate nessacery arrangement......" & vbCrLf
Mymessage = Mymessage & " " & vbCrLf
Mymessage = Mymessage & "Thanks." & vbCrLf & vbcrlf

Mymessage =Mymessage & "Name: " &  Me.Name & vbcrlf
Mymessage =Mymessage & "Service Date: " &  Me.ServiceDate & vbcrlf
Mymessage =Mymessage & "Type ID: " & Me.TypeID



Nerd
Most Valuable Expert 2012
Top Expert 2013
Commented:
If the code is on a different form, use the full form reference instead of "Me.":

Mymessage =Mymessage & "Name: " &  Forms!YourFormName.Name & vbcrlf
Mymessage =Mymessage & "Service Date: " &  Forms!YourFormName.ServiceDate & vbcrlf
Mymessage =Mymessage & "Type ID: " & Forms!YourFormName.TypeID

Open in new window

Author

Commented:
Thank you. That worked perfectly.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial