Results 1 to 2 of 2
  1. #1
    CHEECO is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    156

    Argument Not Optional Error

    I have a form that uses a check box to add and remove a member from a list box. When I check and un-check the box there is a message box that pops up and tells the user whether the member has been added to the list or removed from the list. The members name is being added and removed from the list ok however there is an error with the message box code.



    Code:
    Private Sub Check1409_Click()
    
     ' Note: vbTrue = -1
      If Me.Check1409 = vbTrue Then
        MsgBox ("Member Has Been Added To The List")
      Else
    MsgBox ("Member Has Been Removed From The List")
      End If
    End Sub
    The above is the code that I am using. the error is "Argument Not Optional" and the "MsgBox" in the line MsgBox ("Member Has Been Added To The List") is high lighted in blue. There is no error number.

    I am using Access 2016 32 bit

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Using parentheses indicates a function. Normally a function is used to return a value that must be passed to something, usually to set a variable. So if you want the MsgBox to be just a message to user that they simply read and close, don't use parentheses.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Complie ERROR - Argument not optional
    By BRASILO in forum Access
    Replies: 3
    Last Post: 12-22-2017, 09:49 AM
  2. Replies: 5
    Last Post: 02-28-2017, 09:57 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