Help with calculations

dandaman098

New member
Local time
Today, 14:52
Joined
Feb 16, 2015
Messages
3
Hi I'm doing a college project that requires some database use. I have decided to use the calculations data type but it doesn't seem to be working, i have used it before but its because i use the between operator.

The Calculation is below:
IIf([CycleSpeed]<10,[CycleTime]*236,IIf([CycleSpeed] Between 10 And 11.9,[CycleTime]*354,IIf([CycleSpeed] Between 12 And 13.9,[CycleTime]*472,IIf([CycleSpeed] Between 14 And 15.9,[CycleTime]*590,IIf([CycleSpeed] Between 16 And 20,[CycleTime]*708,IIf([CycleSpeed]>20,[CycleTime]*944,0))))))
 
What exactly does doesn't seem to be working mean? Error message, wrong data???
 
Time to build a function. When your statement gets this complex its time to open a Module and create a function for performing this computation.

You would pass the function The CycleTime and CycleSpeed values, do whatever logic you need to and return the computed value. This way, when stuff goes wrong, you can easily read it and debug it.
 
Hi I'm doing a college project that requires some database use. I have decided to use the calculations data type but it doesn't seem to be working, i have used it before but its because i use the between operator.

The Calculation is below:
IIf([CycleSpeed]<10,[CycleTime]*236,IIf([CycleSpeed] Between 10 And 11.9,[CycleTime]*354,IIf([CycleSpeed] Between 12 And 13.9,[CycleTime]*472,IIf([CycleSpeed] Between 14 And 15.9,[CycleTime]*590,IIf([CycleSpeed] Between 16 And 20,[CycleTime]*708,IIf([CycleSpeed]>20,[CycleTime]*944,0))))))

You don't have to use the BETWEEN operator, from the second argument on you can use =< test ( i.e. =< 11.9, 13.9..etc). Also the closing argument is redundant. You have already tested everything up to 20. So whatever remains must be over 20. Ok ?

Best,
Jiri
 

Users who are viewing this thread

Back
Top Bottom