Results 1 to 11 of 11
  1. #1
    webisti is offline The Wisher
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    115

    multiple iffs

    Hi I am trying to apply a multiple iff
    here is the code:
    STATUS: IIf([013_MK_S]![MOVEMENTS]>5,"FAST MOVER","IIf([013_MK_S]![MOVEMENTS]<5 And >3,"MEDIUM MOVER","IIf([013_MK_S]![MOVEMENTS]< 1,"SLOW MOVER","0")))
    But is not working..where I am doing the error?



    thanks for he help

    Webisti

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,545
    Try this:
    STATUS: IIf([013_MK_S]![MOVEMENTS]>5,"FAST MOVER",IIf([013_MK_S]![MOVEMENTS]<5 And [013_MK_S]![MOVEMENTS] >3,"MEDIUM MOVER",IIf([013_MK_S]![MOVEMENTS]< 1,"SLOW MOVER","0")))
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    I do not think that you can have ([013_MK_S]![MOVEMENTS]<5 and >3, you need to repeat the name of the control between the "and" and the >3



    STATUS: IIf([013_MK_S]![MOVEMENTS]>5,"FAST MOVER","IIf([013_MK_S]![MOVEMENTS]<5 And [013_MK_S]![MOVEMENTS] >3,"MEDIUM MOVER","IIf([013_MK_S]![MOVEMENTS]< 1,"SLOW MOVER","0")))

    BTW what happens if [013_MK_S]![MOVEMENTS] is greater than or equal to 1 but less than or equal to 3? You do not define that category.

  4. #4
    webisti is offline The Wisher
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    115
    Thanks It worked with the separate name controls.
    Actually what I want is this definition
    Fast >5 medium is between 2 to 5 a
    slow is equal to 1 or less.

    Is then anothwe way of doing it?

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,545
    Try this:
    STATUS: IIf([013_MK_S]![MOVEMENTS]>5,"FAST MOVER",IIf([013_MK_S]![MOVEMENTS]<5 And [013_MK_S]![MOVEMENTS] >=2,"MEDIUM MOVER",IIf([013_MK_S]![MOVEMENTS]< 1,"SLOW MOVER","0")))
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    webisti is offline The Wisher
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    115
    Great it worked
    Thanks Bob Fitz and others I just modified it to this : STATUS: IIf([MOVEMENTS]>=5,"FAST MOVER",IIf([MOVEMENTS]<5 And [MOVEMENTS]>=2,"MEDIUM MOVER",IIf([MOVEMENTS]<=1,"SLOW MOVER","0")))
    and it works smoothly.

    thanks guys

  7. #7
    webisti is offline The Wisher
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    115
    ONE MORE TIME PLS
    now I want to use two "and" in one time like this code:
    IIF( [SOH]=0 AND [STATUS]=FAST MOVER AND [STATUS]=MEDIUM MOVER,"PRIORITY",IFF( [SOH] =0 AND CRITICAL=X,"PRIORITY 2",IIF([SOH]=0 AND [PR QTY]>0,"PRIORITY,IIF( [SOH]=0 AND [LEAD TIME].90,PRIORITY,N/A)))
    is that possible?

    thanks again

  8. #8
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,545
    I'm not really sure what you are trying to do exactly, but you could try this:
    IIF([SOH]=0 AND [STATUS]="FAST MOVER" AND [STATUS]= "MEDIUM MOVER", "PRIORITY",IFF([SOH] =0 AND CRITICAL= "X", "PRIORITY 2",IIF([SOH]=0 AND [PR QTY]>0,"PRIORITY", IIF([SOH]=0 AND [LEAD TIME]= 90,PRIORITY,N/A)))
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  9. #9
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    [STATUS]="FAST MOVER" AND [STATUS]= "MEDIUM MOVER",



    I assume that a status can only be 1 value at a time so the above part of the expression will never be satisfied. Should it be OR rather than AND?

  10. #10
    webisti is offline The Wisher
    Windows XP Access 2003
    Join Date
    Jun 2011
    Posts
    115
    well based on the criteria of SOH=0 and is a fast or medium mover put priority,
    soh =0 and critical =x, put priority
    soh=0 and pr qty>0, put priority
    soh=0 and lead time >90 put priority
    that is all I want the iff to do.

  11. #11
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,545
    OK. Does this do it:
    IIF([SOH]=0 AND [STATUS]="FAST MOVER" OR [STATUS]= "MEDIUM MOVER", "PRIORITY",IFF([SOH] =0 AND CRITICAL= "X", "PRIORITY 2",IIF([SOH]=0 AND [PR QTY]>0,"PRIORITY", IIF([SOH]=0 AND [LEAD TIME]> 90,"PRIORITY","N/A")))
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

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

Similar Threads

  1. Replies: 23
    Last Post: 12-06-2011, 09:18 AM
  2. Replies: 4
    Last Post: 06-14-2011, 07:19 PM
  3. Replies: 2
    Last Post: 05-25-2010, 02:45 PM
  4. Replies: 5
    Last Post: 12-10-2009, 10:33 PM
  5. Replies: 1
    Last Post: 12-10-2009, 08:41 PM

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