Results 1 to 4 of 4
  1. #1
    BRASILO is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    77

    Complie ERROR - Argument not optional

    I tried to rewrite this one multiple times, I think my head is just slow today. I can't figure out where I'm making the mistake.



    [code]
    Private Sub cmdEmail_Click()
    On Error GoTo cmdEmail_Click_Err

    On Error Resume Next
    ' the send object line is where I'm getting the "Argument not optional"
    DoCmd.SendObject , "", "", [Contact Name] & IIf(Nz([E-mail Address]) <> "", " [" & [E-mail Address] & "]"), "", "", "", "", True, ""

    If (MacroError.Number <> 0) Then
    Beep
    MsgBox MacroError.Description, vbOKOnly, ""
    End If

    cmdEmail_Click_Exit:
    Exit Sub
    cmdEmail_Click_Err:
    MsgBox Error$
    Resume cmdEmail_Click_Exit
    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
    Your IIf() doesn't have a false argument.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    BRASILO is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Aug 2017
    Posts
    77
    Quote Originally Posted by pbaldy View Post
    Your IIf() doesn't have a false argument.
    Well, not much I can say other than a big thank you! Happy Holidays!

    It's already a long day....

  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
    Happy to help! I'm just getting started.
    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. Replies: 5
    Last Post: 02-28-2017, 09:57 PM
  2. Compile Error: Argument not optional
    By Nadine67 in forum Access
    Replies: 5
    Last Post: 08-02-2015, 03:09 PM
  3. error argument not optional
    By slimjen in forum Programming
    Replies: 10
    Last Post: 03-20-2013, 09:31 PM
  4. Compile Error: Argument not optional
    By tariq1 in forum Programming
    Replies: 4
    Last Post: 08-11-2012, 01:06 PM
  5. Compile Error: Argument Not Optional
    By bg18461 in forum Access
    Replies: 1
    Last Post: 12-01-2010, 08:47 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