I have a field "Number1" and I need another field to check that value and return a different number(ex...if "Number1" is <=100 then $1.27, if "Number1" is between 101 and 200 then it returns $1.15, and so forth up to 1000.
I have a field "Number1" and I need another field to check that value and return a different number(ex...if "Number1" is <=100 then $1.27, if "Number1" is between 101 and 200 then it returns $1.15, and so forth up to 1000.
Where exactly do you want to do this? Query? Form? Report?
What is your database structure (tables and relationships)?
Where does this requirement fit in your overall process?
Either
1. I would do this as a function...
build the code function in a module to return your value
Code:Public Function CalcMyVal(ByVal pvNum) Select Case pvNum Case Is <= 100 CalcMyVal = 1.27 Case 101 To 200 CalcMyVal = 1.15 Case 201 To 300 CalcMyVal = 1.05 End Select End Function
then put the function in a query..
Select CalcMyVal ([NUMBER1]) as Expr1
or
2. build a table with the range [startVal] , [EndVal], [Amt]
if the value is between the 2 fields, return the [amt]
Been a long time since I messed with Access, so I am merely tinkering right now. Only working with a table at the moment. Trying to build a calculated field that can do it, somewhat of a =if formula. I could get it to do a simple one (=if([Number1]<=100, [Number1]*1.27...etc. But that seemed only good for 2 choices (true,false) argument. I need it to go further for 6 different conditions.