Results 1 to 4 of 4
  1. #1
    jgelpi16 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544

    Question HELP - Invalid number of arguments


    I need a second pair of eyes to look at this. I keep getting the error that I have an invalid number of arguments. I am trying to use this IF statement in a text box on a report. Thank you.

    Code:
    =iif(mid([EntityID],3,1) = "-", "XX-XXX" & Mid([EntityID],7,4), iif([mid([EntityID],4,1) = "-", "XXX-XX-" & Mid([EntityID],8,4),"XXXXX" & mid([EntityID],6,4))
    



  2. #2
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    I see an extra [ in the nested IIF() shown in red below, and you have a different amount of ( versus ) . You'll need to add 1 close ) as shown in magenta below.

    iif(mid([EntityID],3,1) = "-", "XX-XXX" & Mid([EntityID],7,4), iif([mid([EntityID],4,1) = "-", "XXX-XX-" & Mid([EntityID],8,4),"XXXXX" & mid([EntityID],6,4)))

  3. #3
    jgelpi16 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544
    Excellent. Thanks a lot!

  4. #4
    jzwp11 is offline VIP
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You're welcome. I've pulled out my hair with some of those nested IIF() functions too!

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

Similar Threads

  1. Invalid Argument Error
    By koper in forum Access
    Replies: 2
    Last Post: 06-14-2010, 11:22 AM
  2. Invalid Use of Null!?!
    By Kipster1203 in forum Access
    Replies: 4
    Last Post: 05-13-2010, 06:09 AM
  3. Open form arguments
    By nkenney in forum Forms
    Replies: 4
    Last Post: 04-10-2009, 08:40 PM
  4. OpenForm Action and Arguments
    By nkenney in forum Forms
    Replies: 9
    Last Post: 04-05-2009, 09:33 AM
  5. Invalid Operation
    By ScottG in forum Forms
    Replies: 0
    Last Post: 11-14-2006, 02:05 PM

Tags for this Thread

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