Results 1 to 4 of 4
  1. #1
    joecamel9166 is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2016
    Posts
    85

    Emailing Report

    Can someone please explain why I am getting an error message when I am running this script.Error Message: The Object type argument for this action or method is blank or invalidCode Used:
    Code:
       If Me.cmbQuoteVia = "Email" Then
          DoCmd.OpenReport "rptQuote", acViewNormal, , "[Unit] = " & [Unit]
          DoCmd.SendObject acSendReport, , acFormatPDF, Me.CustEmailQuote, , , "RSO#" & [Unit], "Please see attached Repair Quote"
       End If

    Last edited by RuralGuy; 06-10-2016 at 01:11 PM. Reason: Formatted code

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Your param are out of order...extra comma
    DoCmd.SendObject acSendReport ,Me.CustEmailQuote,acFormatPDF,TO,CC,BCC,SUBJ,MSG, FALSE

  3. #3
    joecamel9166 is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2016
    Posts
    85
    Me.CustEmailQuote is the field name which contains the email address. Therefore that should be in the "To" parameter.

    I am trying to email a quote for the current "Unit". If I put "rptQuote" in that parameter, it emails all units.

  4. #4
    joecamel9166 is offline Advanced Beginner
    Windows 10 Access 2013 64bit
    Join Date
    Feb 2016
    Posts
    85
    I found the problem.

    Code:
    If Me.cmbQuoteVia = "Email" Then
          DoCmd.OpenReport "rptQuote", acViewReport, , "[Unit] = " & [Unit]
          DoCmd.SendObject acSendReport, , acFormatPDF, Me.CustEmailQuote, , , "RSO#" & [Unit], "Please see attached Repair Quote"
          Docmd.CloseReport 
       End If
    apparently I was not able to email after the report opened in normal view. I had to change it to view report and then close it.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Closing Report after Emailing
    By Robert2150 in forum Access
    Replies: 1
    Last Post: 02-08-2015, 01:31 PM
  2. Emailing report in access
    By Robert2150 in forum Access
    Replies: 2
    Last Post: 09-27-2013, 10:39 PM
  3. Emailing Personalized Report
    By rgrwatson85 in forum Reports
    Replies: 3
    Last Post: 10-20-2011, 10:21 AM
  4. Emailing Report with Attachments
    By Rookie in forum Reports
    Replies: 1
    Last Post: 08-19-2011, 06:52 PM
  5. Emailing a report
    By prv in forum Access
    Replies: 1
    Last Post: 12-20-2010, 04:03 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums