Send current record via email

  • Thread starter Thread starter NP
  • Start date Start date
N

NP

I want to send the currect record of the form by email.
Therefore, I made a command button and want to add code on
the click event...

Could any of the profession can advise me what to write.

Command Button Name: RecoSend
Form Name : BioForm

Thanks
 
You could call a custom function such as the one below and customize it to
your exact needs by retrieving specific values from the record in question
and then including the data in the body of your e-mail.

***********
Function EmailLead()
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment

' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")

' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)

With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add([email protected])
Set objOutlookRecip = .Recipients.Add([email protected])
objOutlookRecip.Type = olTo

' Set the Subject, Body, and Importance of the message.
.Subject = ""
.Body = ""
.Importance = olImportanceHigh 'High importance

'Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
If Not objOutlookRecip.Resolve Then
objOutlookMsg.Display
End If
Next
.Send

End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Function
**********************

Hope this is what you were looking for,

Daniel
 
Back
Top