Removing last digit on different length numbers

vgersghost

Vgersghost
Local time
Today, 10:34
Joined
Apr 29, 2005
Messages
106
Hello:

I have a need to strip off the last digit on a group of numbers:

Example:

0871 --- Just remove the one
13463 --- Just remove the three
and so forth.

I have tried Mids,Lefts,Rights and some combination of those, but I cannot get it to work.

thank you
 
Try

Left(FieldName, Len(FieldName) - 1)
 
Well you could convert it to a string and back, and do it with string functions. Seems like there should be a len for integers, but maybe I am thinking of another language

where intnumber is your field

Dim intLength As Integer
Dim strNumber As String
strNumber =cstr(intnumber)
intLength = Len(strNumber)
intnumber = CInt(Left(strNumber, intLength - 1))
MsgBox intnumber
 
Thank you pbaldy.
Left(FieldName, Len(FieldName) - 1)
It worked and it was so simple. Still learning things and appreciate all the help
 
if its a string, massage it as paul says

if its a number just divide by 10 and round down
instead of / to divide, \does this

so massaged = original\10
 
Hi -

Just a note:

'Real numbers' (versus 0871) don't have leading zeros -- thus the example, if it is actually a working example, is a string.

Bob
 
Last edited:

Users who are viewing this thread

Back
Top Bottom