Results 1 to 4 of 4
  1. #1
    harpreett.singhh@gmail.co is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    25

    iif for 16 conditions

    Hi,

    I have 16 IIF conditions to put into a table where the value of the cell depends on the other value.

    If I select any value out of 16 values of STEP # column then the FINAL STATUS should change to particular value.

    I do not know how to use number range in this, is it possible to give a range ? instead working on individual numbers ? this way I will reduce the text to avoid access saying me too complex query (means it accepts only 14 situations).

    IIf([Step #]=1,"Open",IIf([Step #]=2,"Construction Complete",IIf([Step #]=3,"Documentation Colladed",IIf([Step #]=4,"Final Review",IIf([Step #]=5,"Final Review",IIf([Step #]=6,"Final Review",IIf([Step #]=7,"Final Sign Off",IIf([Step #]=8,"Final Sign off",IIf([Step #]=9,"Final Sign off",IIf([Step #]=10,"Final Sign off",IIf([Step #]=11,"Final Sign off",IIf([Step #]=12,"Final Sign off",IIf([Step #]=13,"Hibernation",IIf([Step #]=14,"Snaglist","Nill"))))))))))))))



    Please advise.

    Regards

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Certainly. Try:

    IIf([Step #]=1,"Open",IIf([Step #]=2,"Construction Complete",IIf([Step #]=3,"Documentation Collated",IIf([Step #]<7, "Final Review", IIf([Step #]<13,"Final Sign Off", IIf([Step #]=13,"Hibernation",IIf([Step #]=14,"Snaglist","Nill")))))))

    Also, explore the Choose and Switch functions.

    Otherwise, build a table of the Step numbers and descriptions and include that table in queries.


    BTW, advise no spaces or special characters/punctuation in naming convention. Better would be StepNum, StepNo, Step_Num.
    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.

  3. #3
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    I prefer Public Functions in Standard Modules for such operations. Easier to understand and document and fix years later. I would probably use a Select Case structure.

  4. #4
    harpreett.singhh@gmail.co is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    25
    Thanks mate. its solved. I have provided range for the steps.

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

Similar Threads

  1. VBA If with multiple conditions
    By Swatskeb in forum Modules
    Replies: 2
    Last Post: 05-22-2014, 04:22 PM
  2. Help with Macro Conditions
    By sai_rlaf in forum Access
    Replies: 3
    Last Post: 01-19-2012, 04:25 PM
  3. Using iif for Multiple Conditions
    By kwilbur in forum Access
    Replies: 5
    Last Post: 12-30-2011, 01:52 PM
  4. Forms and Conditions
    By jlgray0127 in forum Forms
    Replies: 11
    Last Post: 11-02-2011, 02:55 PM
  5. if...then conditions ???
    By em07189 in forum Access
    Replies: 6
    Last Post: 03-05-2010, 10:29 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