Access functions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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)
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top