truncating a string

G

Giz

Hi, I am wondering how I can truncate a field value, it is a string, in one
of my fields. The field is called "userid" and this is example of some
records:

04MT637037056
04MT637037055
04MT637037054
04MT637037052
04MT637037051
04MT637037035
04MT637037034

When I query for this field from a table I would like the query output to
delete the common "04MT637" portion so just the last six digits result in the
field record. I am sure there is a relatively simple method for this.. but
alas I am a beginner and ignorant. Thanks
 
F

fredg

Hi, I am wondering how I can truncate a field value, it is a string, in one
of my fields. The field is called "userid" and this is example of some
records:

04MT637037056
04MT637037055
04MT637037054
04MT637037052
04MT637037051
04MT637037035
04MT637037034

When I query for this field from a table I would like the query output to
delete the common "04MT637" portion so just the last six digits result in the
field record. I am sure there is a relatively simple method for this.. but
alas I am a beginner and ignorant. Thanks

NewColumn:Mid([UserID],8)
will return everything after the 7th character.

Or if the length of the field is always the same 13 character length:
NewColumn:Right([UserID],6)
Will return the last 6 characters.
 
E

Erma

I need to get rid of the first three digits in a field named "Seats". I tried
NewColumn:Mid([Seats],3) and I kept getting errors. The first three digits I
want to get rid of are PL1, PL2, PL3, PL4, PL5 PL6. The following string
differs from 6 digits to 40.

fredg said:
Hi, I am wondering how I can truncate a field value, it is a string, in one
of my fields. The field is called "userid" and this is example of some
records:

04MT637037056
04MT637037055
04MT637037054
04MT637037052
04MT637037051
04MT637037035
04MT637037034

When I query for this field from a table I would like the query output to
delete the common "04MT637" portion so just the last six digits result in the
field record. I am sure there is a relatively simple method for this.. but
alas I am a beginner and ignorant. Thanks

NewColumn:Mid([UserID],8)
will return everything after the 7th character.

Or if the length of the field is always the same 13 character length:
NewColumn:Right([UserID],6)
Will return the last 6 characters.
 
D

Douglas J. Steele

What error did you get? It's difficult for anyone to offer any help without
knowing what the problem is!

And, for what it's worth, to get rid of the first 3 characters, you'd use
NewColumn:Mid([Seats], 4)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Erma said:
I need to get rid of the first three digits in a field named "Seats". I
tried
NewColumn:Mid([Seats],3) and I kept getting errors. The first three
digits I
want to get rid of are PL1, PL2, PL3, PL4, PL5 PL6. The following string
differs from 6 digits to 40.

fredg said:
Hi, I am wondering how I can truncate a field value, it is a string, in
one
of my fields. The field is called "userid" and this is example of some
records:

04MT637037056
04MT637037055
04MT637037054
04MT637037052
04MT637037051
04MT637037035
04MT637037034

When I query for this field from a table I would like the query output
to
delete the common "04MT637" portion so just the last six digits result
in the
field record. I am sure there is a relatively simple method for this..
but
alas I am a beginner and ignorant. Thanks

NewColumn:Mid([UserID],8)
will return everything after the 7th character.

Or if the length of the field is always the same 13 character length:
NewColumn:Right([UserID],6)
Will return the last 6 characters.
 
Top