Email Button

  • Thread starter Thread starter Mavis
  • Start date Start date
M

Mavis

Hi all,

I will like to create a button in my report to allow user to forward the
report as attendment in the email by clicking on the button.

Anyone can advice how can i do that?

Thanks in advance.
 
Hi Marvis

There are a number of way to do this - this is just one simple method

I assum you have a report called ReportName - of course change the code to
what it really is.

Create a form
On the form put a button (called ButtonName)
Add a text box (called EMailAddressTextBoxName)

Put this code OnClick of the button

Private Sub ButtonName_Click()
Dim intResponse As Integer
intResponse = MsgBox("To send the e mail click YES " & vbCrLf & vbCrLf & _
"To cancel sending click NO", vbYesNo, "Report E Mailer")
If intResponse = vbYes Then
DoCmd.SendObject acReport, "ReportName", "RichTextFormat(*.rtf)", _
Me.EMailAddressTextBoxName, "", "", "Your Report", _
"I have attched the report you wanted", False, ""
ElseIf intResponse = vbNo Then
MsgBox "Report sending cancelled", vbOKOnly, "Report E Mailer"
End If
End Sub


Type in an e mail addess then click the button

Of course you can select the e mail address from a combo box - list, etc.
You can improve this by checking that the e mail address is there (is not
null) etc. But the above should start you off

hope this helps
 
Back
Top