Results 1 to 4 of 4
  1. #1
    phanikumarbs is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    2

    IIF Formula Error

    While Executing a Query which has below formula i am getting Over flow error

    Format(Val(IIf(InStr([Shipper'sReferenceNumber]," ")>0,Left([Shipper'sReferenceNumber],InStr([Shipper'sReferenceNumber]," ")-1),[Shipper'sReferenceNumber])),"0")



    Kindly Help me

    Thanks and Regards
    Phani Kumar

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Problem with IIf is that every part must be able to evaluate, even if its not the part that returns value.

    So if there is no space in the string, the Left will fail because can't have negative length, therefore the entire IIf expression fails.

    So maybe make sure there is a space.

    Format(Val(Left([Shipper'sReferenceNumber] & " ", InStr([Shipper'sReferenceNumber] & " ", " ") - 1)), "0")

    If this doesn't resolve issue, provide sample of data in the field.


    BTW, recommend no spaces or special characters/punctuation (underscore is exception) in name convention.
    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.

  3. #3
    phanikumarbs is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    2
    Still Getting the Overflow error

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    My testing with the concatenated space works so something else is wrong. Actually, the negative length would cause a different error message - "Invalid procedure".

    If you want to provide db for analysis, follow instructions at bottom of my post. Identify objects involved.
    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. Error Message Result In Count Formula
    By EHittner in forum Forms
    Replies: 4
    Last Post: 10-22-2013, 10:52 AM
  2. #Num! error in my formula
    By Eastbay2 in forum Access
    Replies: 2
    Last Post: 01-24-2013, 05:14 PM
  3. ERROR msg WHILE USING IIF FORMULA
    By CUCKOO in forum Access
    Replies: 9
    Last Post: 10-03-2012, 12:40 PM
  4. getting a #error from count(iif( formula
    By vickan240sx in forum Access
    Replies: 1
    Last Post: 09-21-2012, 08:34 PM
  5. Error in Formula
    By TheProfessorIII in forum Access
    Replies: 9
    Last Post: 03-21-2011, 05:50 AM

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