View Full Version : IF Statements followed by Calculations


BC_Randall
10-15-2001, 07:15 AM
Can someone tell me how and where I can put in an IF statement to allow for a certain calculation if True, else another IF and a calculation, and an else leading to a different calculation. (In Access 97)
ie. IF x=2, then y+6, Else IF x=3, then y+13, Else y+1

where x and y are fields in my database. Note: This is a simplified example of what I really want, but it will answer my question.

Thanks,

Brian

[This message has been edited by BC_Randall (edited 10-15-2001).]

Jack Cowley
10-15-2001, 07:42 AM
Assuming that the 'y' field contains data then in the After Update event of the 'x' field you can use code like this:

Select Case Me.x
Case 2
y = y + 6
Case 3
y = y + 13
Case Else
y = y + 1
End Select