Consulting

Results 1 to 2 of 2

Thread: SendObject - Report PDF to Email

  1. #1
    VBAX Regular
    Joined
    Dec 2012
    Posts
    7
    Location

    SendObject - Report PDF to Email

    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

  2. #2
    VBAX Contributor
    Joined
    Oct 2011
    Location
    Concord, California
    Posts
    101
    Location
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •