Results 1 to 3 of 3
  1. #1
    hzrdc2 is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Mar 2013
    Posts
    2

    IIF with numbers and letters

    I hate to be the newb that asks what might be an obvious question... I did search, but I'm not sure I am even searching the proper terms.



    I want to have an IIF statement that evaluates numbers and letters:

    =IIf([FA]=6565,"EMPLOYEE NAME","")

    this works, but when I have an employee code such as 82M8 (containing a letter), it chokes...

    Advice?

    Thanks,

    Scott

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    How is the "FA" field defined? What is the data type?
    If it has letters in some entries, I would imagine it must have a Text data type. All text entries must be enclosed in quotation marks, i.e.
    Code:
    =IIf([FA]="82M8","EMPLOYEE NAME","")

  3. #3
    hzrdc2 is offline Novice
    Windows 7 32bit Access 2013
    Join Date
    Mar 2013
    Posts
    2
    Yup, you were exactly correct... not sure why I didn't think to try that, guess cause I am still cutting my teeth.

    I assume that if I had multiple employee codes, I would create a switch?

    =Switch([FA]="6565","NAME 1",[FA]="82M8","NAME 2")

    Seems to work

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

Similar Threads

  1. Have a Query only look at the last 4 letters in a name
    By matthewmessmer in forum Queries
    Replies: 3
    Last Post: 02-11-2013, 12:42 PM
  2. Duplicate first five letters
    By mystifier in forum Queries
    Replies: 1
    Last Post: 09-22-2012, 01:54 PM
  3. Import Errors - Fields with Numbers and Letters
    By Eekers in forum Import/Export Data
    Replies: 5
    Last Post: 01-10-2012, 02:52 PM
  4. Replies: 1
    Last Post: 11-29-2011, 08:43 AM
  5. Removing all letters or all numbers from string
    By Hayley_sql in forum Programming
    Replies: 2
    Last Post: 09-16-2009, 02:01 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