auto email a report with a twist

trackmedic

Registered User.
Local time
Today, 07:47
Joined
Aug 20, 2001
Messages
115
I have a macro that opens a form. On this form I use an unbound menu to select a persons name that populates a report with data concerning this person.

the report opens in print preview. All of that works fine. I would like to send the report that is on the screen via an email as an attachment.

This has to happen after the report is populated by the form choice. If not, the report is blank.

- trackmedic:confused:
 
Hi TrackMedic
I have a form that allows the user to browse to the record that they wish to email and then they click an "email" button. The following code is attached to the buttons "on_Click" event.


Dim MyRptName As String
Dim MyFormat As String
Dim MyTo As String
Dim MySubj As String
Dim MyMsg As String

'*********
' The following lines comment out the various format that you might ike to send the message in.
'HTML (*.htm; *.html)
'Text Files (*.txt)
'Microsoft Active Server Pages (*.asp)
'Microsoft Excel (*.xls)
'Microsoft Excel 5-7 (*.xls)
'Microsoft Excel 97-10 (*.xls)
'Microsoft IIS (*.htx, *.idc)
'Rich Text Format (*.rtf)
'Data Access Page (*.htm; *.html)
'XML (*.xml)

DoCmd.SetWarnings False

MyRptName = "MyInvoiceName" & Me.InvID
MyFormat = "SnapshotFormat(*.snp)"
MyTo = Me.Label16.Caption
MySubj = "Please find our invoice " & Me.InvID & " attached"
Me.Text17.SetFocus
MyBody = Me.Text17.Text

DoCmd.SendObject acReport, "RptSingleInvoice", MyFormat, MyTo, "", "", MySubj, MyBody, False, ""

DoCmd.SetWarnings True

Hope this assists you.
 

Users who are viewing this thread

Back
Top Bottom