Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Now-Luanda, Angola, Originally - Anna Bay, New South Wales, Australia
    Posts
    238
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multiple Ifs (Access 2000)

    Is there a way to have an equivalent to IF .. else. For example I need to have a formula calculate using the equivalent of :
    if criteria 1 is true, do calculation1; else if criteria 2 is true do calculation 2; else if criteria 3 is true do calculation 3 etc
    TIA
    Dummy from Down Under <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  2. #2
    New Lounger
    Join Date
    Jul 2001
    Location
    Scottsdale, Arizona, USA
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Multiple Ifs (Access 2000)

    I think what you're looking for is the 'switch()' function. If you Iook it up in Access help, you get this example:

    = Switch([ShipCity] = "Madrid", "Spanish", _
    [ShipCity] = "Berlin", "German", _
    [ShipCity] = "Torino", "Italian", _
    [ShipCountry] = "France", "French", _
    True, "English")

    <img src=/S/king.gif border=0 alt=king width=21 height=22> eric

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Multiple Ifs (Access 2000)

    Hi Steve,
    I think you're looking for the Select Case statement. It works just the way you've described. For Example:<pre>'....
    intCriteria = 3
    Select Case intCriteria
    Case 1
    'Do Calculation1
    Case 2
    'Do Calculation2
    Case 3
    'Do Calculation 3 - since intCriter = 3, this one will be selected
    Case Else
    'Covers any other case (not always needed, but good to have)
    End Select
    '......</pre>

    Check the Access Helpfile for more detailed specifics.

    HTH <img src=/S/salute.gif border=0 alt=salute width=15 height=20>

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Now-Luanda, Angola, Originally - Anna Bay, New South Wales, Australia
    Posts
    238
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Multiple Ifs (Access 2000)

    Thanks for quick response but I must be having a bad hair day - no refence to select case in the help file - though in all honesty I hate the new help file technique in Access 2000 and am probably using old fart searching techniques based on Access 97 <img src=/S/aussie.gif border=0 alt=aussie width=21 height=22>
    Dummy from Down Under <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Now-Luanda, Angola, Originally - Anna Bay, New South Wales, Australia
    Posts
    238
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Multiple Ifs (Access 2000)

    Oops - found it - as everyone but me probably knew , you have to be in VB to get help about it. Thanks again
    Dummy from Down Under <img src=/S/flags/Australia.gif border=0 alt=Australia width=30 height=18>

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Multiple Ifs (Access 2000)

    Steve,

    I haven't met anyone yet who likes the new Help files, including the people I've talked to at Microsoft. <img src=/S/crazy.gif border=0 alt=crazy width=15 height=15> The trick is to use the answer wizard and, as you discovered, the topics returned will depend on whether you'rein the UI or the VBE. Try framing your search string along the lines of "how do I ...." You don't have to include those words, but I've found that approach to give me the best results with the thing.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •