Actually GFK, that Select looks fine. As you know, Select branches to whichever condition 'matches' the expression that's being 'Selected', so whereas in your example X matches 1, 2, 3, 4 or 5 in Hujiklo's code his Select will branch to whichever of the conditions in his Case statements (in order) evaluate to True. I've found it to be a very handy twist on ye olde Select, and I tip my hat to Mr Beaker for introducing me to it.
But I'm sure you know all this. :o)
Hujiklo:
Given the fact your Select statement looks fine, and that occasionally your values don't get assigned at all, I personally think the only suspect out of the code you showed us is the line
I'm a big fan of the use of parentheses for mathematical clarity, so to avoid the possibilty that it could be interpretted as
I would suggest the following
(assuming I've interpretted your intent correctly).
The only other thing to ensure based on what you've shown us is that, if you want to assign a value of some sort every time, to ensure that the type fields you're testing in the above If statement are both less than zero, of course.
But I'm sure you know all this. :o)
Hujiklo:
Given the fact your Select statement looks fine, and that occasionally your values don't get assigned at all, I personally think the only suspect out of the code you showed us is the line
If doclones\cx1# And doclones\cx2# < 0
I'm a big fan of the use of parentheses for mathematical clarity, so to avoid the possibilty that it could be interpretted as
If doclones\cx1# And (doclones\cx2# < 0)
I would suggest the following
If (doclones\cx1# And doclones\cx2#) < 0
(assuming I've interpretted your intent correctly).
The only other thing to ensure based on what you've shown us is that, if you want to assign a value of some sort every time, to ensure that the type fields you're testing in the above If statement are both less than zero, of course.