This code
DoCmd.SendObject _ acSendReport, _ "myreport", _ acFormatRTF, _ "recipient@you.com", _ , _ , _ "Subject", _ "Message", _ False
is how to send the output of the report named "myreport" via e-mail.
I want to put this code in a command button OnClick event procedure in a form - quite easy up to now -. The problem is that I want to limit the records to be sent by email to just the one that is presently displayed by the form and not all of them.
I’ve been doing something like this in order to send just one record of a report to the printer by the following code
Private Sub cmdPrint_Click()
Dim strWhere As String
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[ID] = " & Me.[ID]
DoCmd.OpenReport "MyReport", acViewPreview, , strWhere
End If
End Sub
Is it possible to modify the first bit of code (send the email) in order to limit the record to be sent by a clause where (which is apparently not supported by “sendobject”)?
Any help for this?
thanks