Results 1 to 2 of 2
  1. #1
    Oldie is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Feb 2012
    Posts
    1

    Nested IIF


    Hi,
    I'm trying to create a nested iif statement for a price list I have. In the list it has Part #, Qty1 Price1, Qty2 Price2, Qty3 Price3 and so on. Not all the Price columns are filled, may not have a price until we meet Qty4 so I need the query to find the fist avail price, so if no price in price1 use price2, if nor price in price2, use price3 and so on, to price5, I'm not concerned with the qty's as I have that sorted
    I have tried IIF(Isnull([Price1]),[Price2],IIF(Isnull([Price2]),[Price3],IIF(Isnull([Price3]),[Price4],[Price1])))

    Any help or suggestions would be appreciated.
    Regards Oldie (but still a goodie)

  2. #2
    Aragan is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Posts
    22
    use the Switch function:

    The syntax for the Switch function is:
    Switch ( expression1, value1, expression2, value2, ... expression_n, value_n )
    expression1, expression2, expression_n is a list of expressions that are evaluated. The Switch function is looking for the first expression that evaluates to TRUE.
    value1, value2, ... value_n is a list of values. The Switch function will return the value associated with the first expression that evaluates to TRUE.

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

Similar Threads

  1. Nested IIf Statement
    By traquino98 in forum Queries
    Replies: 5
    Last Post: 06-11-2011, 10:56 AM
  2. Nested SQL Query
    By springboardjg in forum Queries
    Replies: 5
    Last Post: 05-08-2011, 05:01 PM
  3. Nested data
    By guichemot in forum Database Design
    Replies: 5
    Last Post: 01-17-2011, 01:20 PM
  4. Nested IIF problems
    By Brian Collins in forum Access
    Replies: 2
    Last Post: 10-12-2010, 01:37 PM
  5. Nested Iif statement help
    By Goodge12 in forum Queries
    Replies: 6
    Last Post: 09-21-2010, 11:45 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