Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2007
    Posts
    127

    Unanswered: IIf statement not compiling

    Hi,

    I am trying to create a IIf statement. Basically what I want to do is


    If Local_Data = "ARMY" or "RAF" or "RN" then I want it be called "CDM"

    also

    If PatientCategory = "2" then "Private" otherwise NHS

    I've tried creating a statement, but it doesn't compile

    NHS/CDM/PP: IIf([Local_Data]="ARMY" Or "RAF" Or "RN","CDM",(Left([PatientCategory],1)="2","PRIVATE","NHS"))



    Thanks in advance
    Last edited by akhlaq768; 10-15-07 at 12:37.

  2. #2
    Join Date
    Feb 2004
    Posts
    137
    What you need is the Switch() function. Try this:

    NHS/CDM/PP: Switch([Local_Data] In ("ARMY","RAF","RN"),"CDM",Left([PatientCategory],1)="2","PRIVATE",True,"NHS")

  3. #3
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Computers aren't as clever as you, they require
    Code:
    If Local_Data = "ARMY"
    Or Local_Data = "RAF"
    Or ... Then.
    Alternatively you may want to look into the IN() sytax
    Code:
    If Local_Data IN ("ARMY", "RAF", "RN") ...
    Good luck and let us know how you get on!
    George
    Home | Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •