CraigDolphin
GrumpyOldMan in Training
- Local time
- Today, 04:34
- Joined
- Dec 21, 2005
- Messages
- 1,582
Hi folks.
I'm having an issue with some nested select case statements that aren't returning the expected result
the code is in a public function called QualityAssurance and the top-level select case appears to be working correctly because the result is coming from the appropriate part of the code at that level.
The select case statement that is giving me the wrong result is
I supply the function with two values, and the variable mydifference is set using the equation
mydifference = Abs(value1 - value2)
both 'values' are of the double data type, as is the mydifference variable.
When the two values supplied to the function are 3.4 and 3.3 the mydifference variable = 0.1 but the function's output is 'Fair' rather than 'Good'.
I've checked to be sure the mydifference value is numeric at the point of the evaluation (it is). I've tried re-writing the case tests like:
But the result is the same. Shouldn't a mydifference = 0.1 evaluate to 'good'?What am I missing?
I'm having an issue with some nested select case statements that aren't returning the expected result
the code is in a public function called QualityAssurance and the top-level select case appears to be working correctly because the result is coming from the appropriate part of the code at that level.
The select case statement that is giving me the wrong result is
Code:
Select Case mydifference
Case Is <= 0.1
QualityAssurance = "Good"
Case Is <= 0.2
QualityAssurance = "Fair"
Case Is > 0.2
QualityAssurance = "Poor"
End Select
I supply the function with two values, and the variable mydifference is set using the equation
mydifference = Abs(value1 - value2)
both 'values' are of the double data type, as is the mydifference variable.
When the two values supplied to the function are 3.4 and 3.3 the mydifference variable = 0.1 but the function's output is 'Fair' rather than 'Good'.
I've checked to be sure the mydifference value is numeric at the point of the evaluation (it is). I've tried re-writing the case tests like:
Code:
Select Case mydifference
Case 0 To 0.1
QualityAssurance = "Good"
Case Is <= 0.2
QualityAssurance = "Fair"
Case Is > 0.2
QualityAssurance = "Poor"
End Select
But the result is the same. Shouldn't a mydifference = 0.1 evaluate to 'good'?What am I missing?