Results 1 to 10 of 10
  1. #1
    CUCKOO is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    5

    ERROR msg WHILE USING IIF FORMULA

    In IIF formula if I use Left formula as false part I get a msg "THE EXPRESSION COULD NOT BE SAVED BECAUSE ITS RESULT TYPE, SUCH AS BINARY OR NULL, IS NOT SUPPORTED BY SERVER".


    See the example below

    =IIF(EXPRESSION,TRUE PART,LEFT(XYZ,1))

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Sounds like the wrong value type is trying to be stored in the field.
    What is the field type that the value is going to be saved in? Can the field type handle a binary or NULL value?

  3. #3
    CUCKOO is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    5
    Quote Originally Posted by ssanfu View Post
    Sounds like the wrong value type is trying to be stored in the field.
    What is the field type that the value is going to be saved in? Can the field type handle a binary or NULL value?
    Thanks for reply

    Field type is text

    cuckoo

  4. #4
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    How about typing out exactly what your iif statement is, what are you testing your string for? length? character content?

  5. #5
    CUCKOO is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    5
    Quote Originally Posted by rpeare View Post
    how about typing out exactly what your iif statement is, what are you testing your string for? Length? Character content?

    my table with first row header

    p1 p2 p3 p4 p5
    chc 26 da ep
    cfc 36 da ip
    rgtho r 56 dalh h3
    mgo r 76 da op
    ygc 39 da jp

    expression

    iif(left([p1],1)="c",left([p3],1)&left([p1],2),left([p3],1)&left([p1],1))

    field type ----- text

  6. #6
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    dup post deleted

  7. #7
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    I ran a test on the exact data you gave and I get the results

    2CH
    3CF
    5R
    7M
    3Y

    Is this iif statement in a query or is it a formula on a form or report? are you sure this is what's causing your error message?

    EDIT: one more thing, are you you absolutely certain that your p1 and p3 fields *always* have a value? if they can be or are null values in your table that could be causing some problems as well

  8. #8
    CUCKOO is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    5
    Thanks

    I am using the formula in Table calculated field.

    P1 is never Null but P3 can be. Is this the reason for getting error.




    Quote Originally Posted by rpeare View Post
    I ran a test on the exact data you gave and I get the results

    2CH
    3CF
    5R
    7M
    3Y

    Is this iif statement in a query or is it a formula on a form or report? are you sure this is what's causing your error message?

    EDIT: one more thing, are you you absolutely certain that your p1 and p3 fields *always* have a value? if they can be or are null values in your table that could be causing some problems as well

  9. #9
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    In all likelyhood yes, try this:

    iif(left([p1],1)="c",(iif(isnull([p3], null,left([p3],1)))&left([p1],2),(iif(isnull([p3], null,left([p3],1)))&left([p1],1))

    I didn't test it but you get the idea.

  10. #10
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Or use the NZ() function (Null to zero) to change the Null to a number or empty string. See help.

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

Similar Threads

  1. Replies: 12
    Last Post: 10-22-2012, 06:11 AM
  2. getting a #error from count(iif( formula
    By vickan240sx in forum Access
    Replies: 1
    Last Post: 09-21-2012, 08:34 PM
  3. Formula
    By Ray67 in forum Queries
    Replies: 53
    Last Post: 08-09-2012, 01:56 AM
  4. Error in Formula
    By TheProfessorIII in forum Access
    Replies: 9
    Last Post: 03-21-2011, 05:50 AM
  5. SQL Formula to Sum Itself
    By Scorpio11 in forum Access
    Replies: 1
    Last Post: 02-19-2011, 11:22 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