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

    Question Textbox IIF statement not working

    I have a simple IIF statement set up in a text box and it is not working. The table it refers to has all fields defined as text.



    Code:
    =IIf([EmpName]="","Unassigned","Assigned to " & [EmpName])
    For some reason it always returns the false value. I have tried this as well as

    Code:
    =IIf([EmpName]=Null,"Unassigned","Assigned to " & [EmpName])
    and
    Code:
    =IIf([EmpName] is null,"Unassigned","Assigned to " & [EmpName])
    None have worked, they all return the false condition. What am I doing wrong? Thank you in advance for your help.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    two substitutes you might want to try just on first glance of this:


    instead of "Assigned to " & [EmpName] ... use "Assigned to '" & [EmpName] & "'"

    instead of [EmpName] is null ... try either isnull([EmpName]) or [EmpName] = null

  3. #3
    jgelpi16 is offline Expert
    Windows XP Access 2007
    Join Date
    Mar 2010
    Location
    Charlotte, NC
    Posts
    544
    Thanks for your help. isnull([EmpName]) worked perfectly.

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

Similar Threads

  1. Not sure why textbox not working for some values
    By jtkjames in forum Programming
    Replies: 1
    Last Post: 07-21-2010, 04:26 AM
  2. Replies: 2
    Last Post: 06-14-2010, 09:38 PM
  3. using textbox with In () in query
    By TheShabz in forum Forms
    Replies: 4
    Last Post: 04-10-2010, 12:00 PM
  4. total in textbox
    By micfly in forum Access
    Replies: 3
    Last Post: 11-09-2008, 11:24 AM
  5. Textbox will not allow input
    By cwf in forum Forms
    Replies: 0
    Last Post: 04-04-2008, 04:08 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