Results 1 to 10 of 10
  1. #1
    mrwhitehat is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7

    Help with IIF expression

    I am using the following expression, but it returns an error. Could you guys tell me what I am doing wrong?


    "Ministries Ministry" is a text field.

    Code:
    =IIf(IsNull([Ministries Ministry]),"No Ministries on Record",[Ministries Ministry])
    Thanks!

  2. #2
    mrwhitehat is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7
    Okay, I figured out the answer to my own question. Sorry!

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Expression looks okay to me but Nz is simpler.

    =Nz([Ministries Ministry], "No Ministries on Record")
    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.

  4. #4
    mrwhitehat is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7
    Worked great! Thank you June7.
    Any ideas on my other question in this forum?

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Yes, I will try to answer it later tonight if, no one else has, when I can look at my db. I have a similar situation and need to review how I handled it.
    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.

  6. #6
    mrwhitehat is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7
    Actually, after double checking the data, the NZ did not work. It goes to the null text regardless of the content of the field. Any thoughts? Thank you!

  7. #7
    mrwhitehat is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7
    Okay, I had the two arguments reversed. Now it returns a "Size!" Error.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Possibly the field actually has an empty string, not Null. I don't allow empty strings in tables. Is that a native field in table or result of a calculation that returns empty string?

    Try:

    =IIf([Ministries Ministry]="", "No Ministries on Record", [Ministries Ministry])

    Rather odd field name, seems redundant.

    EDIT: Did not see the post about Size! error. Don't know why that is happening.
    Last edited by June7; 08-27-2013 at 01:12 AM.
    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.

  9. #9
    mrwhitehat is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7
    Now it says "#Type!"
    It is imported data. Is returns no value when viewed, so I am not sure if it is NULL or just blank.

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Don't understand Size! error.

    One of those expressions should work.

    What is the field type? Do you want to provide db for analysis? Follow instructions at bottom of my post.
    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. Replies: 2
    Last Post: 11-20-2012, 03:21 AM
  2. Replies: 4
    Last Post: 10-26-2012, 12:49 AM
  3. Expression Help
    By bboyd in forum Access
    Replies: 3
    Last Post: 11-25-2011, 06:11 AM
  4. Expression
    By jltm8 in forum Access
    Replies: 5
    Last Post: 11-03-2011, 10:09 AM
  5. Expression value
    By KWarzala in forum Reports
    Replies: 0
    Last Post: 06-15-2010, 12:35 PM

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