Results 1 to 12 of 12
  1. #1
    Voodeux2014 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Location
    Slidell, LA
    Posts
    130

    Question Compile Error: Expected: list separator or )


    I am getting this error message when trying to write out this code. It is highlighting the semicolon after the first email address. Here is the code.

    Code:
    Private Sub Command35_Click()
        DoCmd.SendObject(acSendReport, _
        rptDeviceCost, _
        acFormatPDF, _
        "martin@pecsafety.com"; "Lewis@pecsafety.com"; "Matt@pecsafety.com", _
        "Emile@pecsafety.com"; "sean@pecsafety.com", _
        , _
        "Device Cost Report - Test", _
        "This is a test. Please disregard this email for now.", _
        True, )
    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    You want one string:

    "martin@pecsafety.com; Lewis@pecsafety.com; att@pecsafety.com"
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Voodeux2014 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Location
    Slidell, LA
    Posts
    130
    Ok got that changed and now I get the "Compile error: Expected: expression" error and it highlights the closing parenthesis.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    There should not be a comma after True.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Voodeux2014 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Location
    Slidell, LA
    Posts
    130
    Hmm ok. Still getting the same error. Nothing highlighting this time but getting "expected: =" message

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    If rptDeviceCost is the actual name of the report (as opposed to a variable containing one), it needs to be in quotes. Did you fix the second group of addresses? You might try sending a simple email on one line, then break it onto different lines once you get it working.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Voodeux2014 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Location
    Slidell, LA
    Posts
    130
    Put the report name in quotes and yes the CC line of address I corrected as well. Broke it down to one line and even retyped all of it, still getting the same error as previously mentioned.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What is the code now? I don't usually include parentheses, though they may be okay.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Voodeux2014 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Location
    Slidell, LA
    Posts
    130
    Code:
    Private Sub Command35_Click()
        DoCmd.SendObject(acSendReport, "rptDeviceCost", acFormatPDF, "martin@pecsafety.com; Lewis@pecsafety.com; Matt@pecsafety.com", "Emile@pecsafety.com; sean@pecsafety.com", , "Device Cost Report - Test", "This is a test. Please disregard this email for now.", True)
    End Sub

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Try this, which compiles for me:

    DoCmd.SendObject acSendReport, "rptDeviceCost", acFormatPDF, "martin@pecsafety.com; Lewis@pecsafety.com; Matt@pecsafety.com", "Emile@pecsafety.com; sean@pecsafety.com", , "Device Cost Report - Test", "This is a test. Please disregard this email for now.", True
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  11. #11
    Voodeux2014 is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Nov 2014
    Location
    Slidell, LA
    Posts
    130
    Ouutstanding. Thank you very much! It works!

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Compile error: Expected end of statement
    By ritati in forum Macros
    Replies: 1
    Last Post: 12-05-2014, 05:33 AM
  2. Compile Error: Expected: list separator or )
    By jabadoojr in forum SQL Server
    Replies: 6
    Last Post: 10-22-2013, 01:55 PM
  3. Compile error: Expected: list separator or )
    By ThatWumboGuy in forum Programming
    Replies: 2
    Last Post: 08-03-2013, 10:33 PM
  4. Compile Error: Expected: list separator or )
    By Kirsti in forum Programming
    Replies: 2
    Last Post: 03-27-2012, 02:52 PM
  5. compile error: expected end of statement
    By RedGoneWILD in forum Programming
    Replies: 5
    Last Post: 07-29-2010, 10:12 AM

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