Results 1 to 2 of 2
  1. #1
    rbee is offline Novice
    Windows XP Access 2007
    Join Date
    Jul 2012
    Posts
    7

    Need help interpreting mutiple IIF statement

    Hello,



    I've "inherited" someone else access DB and I need help to interpret this selection logic:

    IIf(IsNull(a.[Lifecycle Stage 4 Sub-Stage]),IIf(IsNull(a.[Lifecycle Sub Stage 2]), a.[Lifecycle Stage], a.[Lifecycle Sub Stage 2]), a.[Lifecycle Stage 4 Sub-Stage]) AS [Sanitized Phase],

    What I think it's saying:
    If [Lifecycle Sub Stage 2] is null, use [Lifecycle stage], if [Lifecycle Sub Stage 2] is not null use [Lifecycle Sub Stage 2].
    If [Lifecycle Stage 4 Sub-Stage] is not null, use [Lifecycle Stage 4 Sub-Stage].

    I am not 100% sure if this is the correct interpretation as I have not had much previous experience interpreting multiple IIF statements in access. My aim is to migrate this process to Oracle, so I am just trying to get a handle around all the Access logic so that I can replicate the same behavior in another environment.

    Any help with this would be much appreciated!

    Thanks,
    Raina.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Starting from the left:

    If [Lifecycle Stage 4 Sub-Stage] is null then do inner IIf else use [Lifecycle Stage 4 Sub-Stage]

    An alternative structure is:

    Nz([Lifecycle Stage 4 Sub-Stage], Nz([Lifecycle Sub Stage 2], [Lifecycle Stage]))

    Nz() is an Access/VBA exclusive function.
    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.

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

Similar Threads

  1. product with mutiple colors
    By kelvinkind in forum Access
    Replies: 6
    Last Post: 06-26-2014, 10:19 PM
  2. Forms using mutiple tables
    By cantord in forum Forms
    Replies: 11
    Last Post: 10-26-2012, 08:58 AM
  3. mutiple joins
    By mothermugger in forum Queries
    Replies: 1
    Last Post: 11-15-2011, 04:06 PM
  4. Replies: 7
    Last Post: 12-03-2010, 11:09 AM
  5. Searching mutiple tables
    By mbolster in forum Access
    Replies: 8
    Last Post: 07-06-2010, 10:16 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