Access functions

J

Jeanne T

Which function do I use if I want to take out leading characters in a number?

Ex: "000192000" I want to display "92000", so I want to take out the
"0001" from all the records?
 
K

Kerry

Is it always the first 4 characters you want to remove? Are you sure
this is a number? Since you have leading 0's, I suspect it is text.

If this is a text field you want to remove the 4 leading characters
then use the mid function:

Mid([Field Name],5)
 
L

Lance

There are a couple functions that could accomplish this, each providing a
different approach which may be needed depending on how your data is set up.

Right("000192000", 5) 'Return rightmost 5 characters of the string

Mid("000192000", 5) 'Return all characters, starting from the 5th
character in the string

If you're going to have variable numbers of leading characters, use the
right function. If you're going to have variable numbers of characters you
want to keep, but the "prefix" will always be the same length use the mid
function.

If it's always going to be a static number of characters.. either will work
just as well as the other.
 
Top