|
Email
a Snapshot of your reports.
Place
this code in a OnClick event procedure of a command button on a
form. When you click it,
a dialog box opens letting you choose to either print or email the
report.
‘*******Start
Code ***********
Private
Sub Command_Click()
On
Error GoTo Err_ Command _Click
Dim stDocName As String
Dim
stEmail As String
Dim stText
As String
Dim stSubj
As String
Dim
Response As Integer
stDocName = "Your Report Name"
stText =
"Place the text of your message here."
stSubj =
"Place a brief subject here."
If MsgBox("Click 'Yes' to Email or 'No to print the
report?", vbYesNo, _
"Reports")
= vbNo Then
DoCmd.OpenReport
stDocName, acPreview
Else
stEmail
= "FirstName;SecondName" 'Enter
email names; separate with semi-colons
DoCmd.OpenReport
stDocName, acViewPreview
DoCmd.SendObject
acReport, stDocName, "SnapshotFormat (*.SNP)", stEmail, ,
, stSubj, stText
DoCmd.Close
acReport, stDocName
End If
Exit_Command_Click:
Exit Sub
Err_
Command _Click:
MsgBox
Err.Description
Resume
Exit_ Command _Click
End
Sub
‘*******End
Code ***********
[Return
to top]
|