Log in

View Full Version : SendObject - Report PDF to Email



Will_J
09-13-2013, 07:32 AM
Hi All,

Thanks inf advance for the help with this, I've spent a fair bit of time playing around with it but nothing seems to be working.

I am trying to send a report in PDF format using the SendObject command, this will execute when a check box is ticked.

The Error I get is;

'Compile error; Wrong number of arguments or invalid property argument'

I've been through a fair few times and can't see it : (! Help

The code is as follows;


Private Sub ProductionRequestsEmail_AfterUpdate()
If ProductionRequestsEmail = True Then
varTo = [ContactEmail]
varCC = "XXX@XXX.COM"
varSubject = [tbDocumentSubmissionID]
varBody = "Please find your attached report ... "

DoCmd.SendObject acSendReport, "rptPC", acFormatPDF, varTo, varCC, , varSubject, varBody, , , , True

End If
End Sub

mrojas
09-16-2013, 08:43 PM
It appears to me that you have 2 too many commas at the end, thus the error message wrong number of arguments.
The .SendObject is a function and it expects 10 parameters. You're passing to it 12; the function does not know what to heck to do with the extra two.