email forms and reports

D

deb

I have a listbox with reports and forms that the user selects and then clicks
the cmdEmail button to send them in an email. See below for the button code.

This code only works if I send a report. How can I get this to send both
reports and forms(charts,pivots)?

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

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

Thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top