Right And 0

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

When using the Right() function it's not returning 0.
TxtResult = Right(num,1)

3.90 returns 9
How do I get it to return 0 when it's 0 ?
Thanks
DS
 
Not sure exactly what you are expecting.
The trailing zero is not a significant digit.
Additionally the final digit of a floating point number is not clearly
defined.


Is num a text box? Do you want the right-most displayed digit while the text
box has focus? If so, you could refer to the Text property:
= Right([num].Text,1)

Or do you want all numbers to be treated as if they had 2 significant
places? If so, try:
= Right(Format([num], "#.00"),1)
 
Allen
num is an actual number. I just want to grab the last number of a currency
field. These fields have no trailing numbers at all. The choice of numbers
would be...
0,1,2,3,4,5,6,7,8,9
I need to grab the last number, it's works fine for all numbers except 0. I
need to know if it' zero.
Thnaks
DS
 
Internally, Access stores 4 digits after the decimal place in a Currency
field. In most cases, it only displays 2 (the cents), but you can clearly
see the other 2 if you enter 2.1876, and then tab back into the text box
again.

For that example, did you want the 6 (which is the last stored digit), or
the 9 (which is the display digit when rounded to 2 places)?
 
Thanks Allen this worked.
Dim PValue As Integer
PValue = right(Format(PNum, "#.00"), 1)
Formatting the number first did the trick.
Once again Thank You
DS
 
Back
Top