Report Format with Email

fenhow

Registered User.
Local time
, 18:09
Joined
Jul 21, 2004
Messages
599
I have a fairly robust Access DB. In my reports section the user can select a variety of reports to pull. When the report is generated is there a way that I can add a "SEND EMAIL" button to the report page. I suppose what I am trying to do is make it easy for the user to email the report without any additional steps. Can I edit the REPORT Template to include the email button on all reports generated. Using the Outlook and sending the report HTML or TEXT is okay.

Thanks.
 
You can add a button to a form to do this and take your report accross to an email adding in all the recipients of your choice. Buttons are meant to be placed on forms as opposed to reports.

Say for example you had a list box containing all your report names and a second listbox containing all the names of the contact on your database then you can choose the people you want to mail which report(s) to

You could then have a text box on the form set to memo to type any message you want to include with the atachments.

If you should choose to follow this method and use HTML format, the coding would look similar to this

Private Sub cmdEmail_Click()
On Error GoTo Err_cmdEmail_Click

Dim strDocName As String
Dim strEmail As String
Dim strMailSubject As String
Dim strMsg As String

strDocName = Me.lstRpt
strEmail = Me.txtSelected & vbNullString
strMailSubject = Me.txtMailSubject & vbNullString
strMsg = Me.txtMsg & vbNullString & vbCrLf & vbCrLf & "Your Name" & _
vbCrLf & "MailTo:youremailaddress"

DoCmd.SendObject objecttype:=acSendReport, _
ObjectName:=strDocName, outputformat:=acFormatHTML, _
To:=strEmail, Subject:=strMailSubject, MessageText:=strMsg

Exit_cmdEmail_Click:
Exit Sub

Err_cmdEmail_Click:
MsgBox Err.Description
Resume Exit_cmdEmail_Click

End Sub
 
Last edited:
Hi Fenhow

with regards to your PM, I am not sure if you have seen the above response as you did not mention this. I am replying to you here as I don't think attachments can be uploaded in a private message? Thought a little sample of the above may come in handy.

Let me know if you still need help.
Hay
 

Attachments

Thanks

Thanks, Hayley.

I never did see this one.

Fen
 
@Hayley:
If I use your db example (after converting to access 2003) and click the send option, all dots are replaced by semicolons (ie someone@home.com -> someone@home;com).
Anyway to avoid this?
 
Is there a way to make a button that would send the HTML in the e,ail's message and NOT as an attachment? All users will be using Outlook 2000+

Thank you
 
Thank you Hayley, very appreciated... I hope to make this work!

BTW:

I have added Outlook 10.0 library and that has solved the problem

I use Outlook 2003, some users will have Outlook 2000, is this going to cause me problems?
 
Last edited:
Hi, is it possible to get this to print to PDF first then send via email?
 
Thats not quite what im after

Code:
Private Sub cmdEmail_Click()
On Error GoTo Err_cmdEmail_Click

    Dim strDocName As String
    Dim strEmail As String
    Dim strMailSubject As String
    Dim strMsg As String

    strDocName = Me.lstRpt
    strEmail = Me.txtSelected & vbNullString
    strMailSubject = Me.txtMailSubject & vbNullString
    strMsg = Me.txtMsg & vbNullString & vbCrLf & vbCrLf & "Your Name" & _
        vbCrLf & "MailTo:youremail@nowhere.com"
    
    DoCmd.SendObject objecttype:=acSendReport, _
        ObjectName:=strDocName, outputformat:=acFormatHTML, _
        To:=strEmail, Subject:=strMailSubject, MessageText:=strMsg

Exit_cmdEmail_Click:
    Exit Sub

Err_cmdEmail_Click:
    MsgBox Err.Description
    Resume Exit_cmdEmail_Click
    
End Sub

In the above section of code the report is converted to an HTML document before emailing. I want it to convert to a PDF document before emailing.

Can anyone help me with this? :)
 
Can't quite see why you would want to convert it to HTML and then PDF it prior to sending?
 
No, sorry, i got the code off someone else and i want it to go into PDF instead of HTML

Anyone know how to do this?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom