Results 1 to 6 of 6
  1. #1
    avworx is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    9

    If...Then... Else need help

    How could I use two similar criteria in one if... then block? for example


    if textbox1.value = "A" or "A1" then...
    docmd bla bla

    Thanks.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Code:
    if something then
        if something else then
           BOTH TRUE
        end if
           ONLY FIRST 1 TRUE
    end if
    or:

    Code:
    SELECT CASE myCriteria
    case is something
       do something
    case is somethingelse
       do something else
    case else
       do something that doesn't match any cases
    END SELECT
    or:

    Code:
    if something then
       do something
    elseif
       do something else
    elseif
       do something else, but not the above 2 things
    else
       do something that doesnt match the above 3
    end if

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    if textbox1.value = "A" or textbox1.value = "A1" then
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    avworx is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2011
    Posts
    9
    Thanks Adam, my code is a little long to reuse it, so I was looking for something more compact
    @ Paul, thanks a lot that what I was looking for. great solution!!!
    thanks a lot again guys!!!

  5. #5
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Quote Originally Posted by avworx View Post
    Thanks Adam, my code is a little long to reuse it, so I was looking for something more compact
    @ Paul, thanks a lot that what I was looking for. great solution!!!
    thanks a lot again guys!!!
    hmmm....Paul will always be a thorn in my side. Love ya, Paul!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help avworx.

    Sorry Adam...NOT!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Tags for this Thread

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