Results 1 to 4 of 4
  1. #1
    joeydiaz is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    2

    What expression can I use to return more than two possible values from one field

    Greetings all,



    I have a field [Contract_Due] that is based on a date the user inputs. The expression I am currently using, (IIf), works fine to return two responses;

    Contract_Status: IIf([Contract_Due]<62,"Call Contact","Good")

    The Contract_Due value is a number and ranges depending on the difference between the date assigned and the current date().

    The True value being "Call Contact" if the Contract_Due value is <62.

    The False value is "Good" for anything over 62 days.

    While this is a working solution for the time being, I would like to include another criteria. Where if Contract_Due value falls under lets say -40 it should display "Time & Material".

    I am fairly new to building expressions so please forgive me if this is an easy solution, but with that said, how would I go about building the expression to either replace the IIf expression or add to it to include the new criteria? I am using Access 2010.

    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    You can nest one IIf() function within either the true or false argument of another. You might also look at the Switch() function. I might put the data into a table to make it more dynamic.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    joeydiaz is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2014
    Posts
    2

    Resolved!!

    Quote Originally Posted by pbaldy View Post
    You can nest one IIf() function within either the true or false argument of another. You might also look at the Switch() function. I might put the data into a table to make it more dynamic.
    Thanks Pbaldy! That fixed my problem!

    Here's the end formula,

    Contract_Status: Switch([Contract_Due]<=-40,"T & M",[Contract_Due]<=62,"Call Contact",[Contract_Due]>62,"Good")

    I'll have to remember the switch function. I did'nt really want to try two IIf statements, that seemed like more trouble for me. Switch() worked like a charm!

    Thanks again man

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Happy to help and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 7
    Last Post: 07-02-2013, 12:02 PM
  2. Replies: 10
    Last Post: 04-17-2013, 04:15 PM
  3. Replies: 5
    Last Post: 03-22-2013, 01:11 PM
  4. Replies: 20
    Last Post: 09-12-2012, 06:52 PM
  5. Replies: 5
    Last Post: 05-22-2012, 08:06 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