Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2006
    Posts
    19

    Unanswered: combining if then statements

    how do you combine if then statments in access?, i want to say if the payment grouping is pharmacy, the maximum is 1500 if the member is in group x. if the payment grouping is pharmacy and the member is in group y, the max is 2000

    thanks!

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    If X then
    ElseIf Y then
    ElseIf z then
    ...
    else
    Endif

    The Access Help gives you the various permutations of the If Then Else ....
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by wab777
    how do you combine if then statments in access?, i want to say if the payment grouping is pharmacy, the maximum is 1500 if the member is in group x. if the payment grouping is pharmacy and the member is in group y, the max is 2000

    thanks!
    ...or better still put these business rules into a table and retrieve the deatils from the table rahter than coding it.


    that way round you can (or better yet your users can) make whatever changes you (they) require through data, rather than a code change
    I'd rather be riding on the Tiger 800 or the Norton

  4. #4
    Join Date
    Mar 2007
    Posts
    14
    You could consider using the "select case statement", see the VBA help for examples.

  5. #5
    Join Date
    Jan 2007
    Location
    California, USA
    Posts
    520
    Code:
    If PaymentGrouping = "Pharmacy" then
       If group = "x" then
          Maximum = 1500
       Else If group = "y" then
          Maximum = 2000
       End If
    End If


Posting Permissions

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