How to send the current record of the form via email

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to send the current record of my form via email. Therefore, I would
like to add a command button and on that click event code to do it.

Could any of the professional can advise this.

regards
 
Below is part of an example that I use in class to teach delegates the DoCmd
feature. You can create a loop to automatically go through all items on the
form, but visually, it won't look as good as you might want.

The vbCRLF is a carriage-return; an enter, in other words. The only two
fields I've used are the FirstName and HowOld fields.

Try typing in the DoCmd.SendObject yourself and use the hints, if you've
not come across them before.

Hope this helps,

Piers

' Send a Happy Birthday e-mail to current employee with

' congratulatory text

' Remember to specify the type of variable

Dim Subject, Body As String



' Create Subject and Body of e-mail, using FirstName and HowOld fields

Subject = "Happy Birthday"

Body = "Hi there " & FirstName & vbCrLf & _

"Congratulations on reaching " & HowOld & " years young!" & vbCrLf & _

vbCrLf & _

"Well done!" & vbCrLf & _

"The Management."



' e-mail SendObject

DoCmd.SendObject , , , , , , Subject, Body
 
Back
Top