Need the last 5 numbers in another field

  • Thread starter Thread starter Jimmy
  • Start date Start date
J

Jimmy

Hello I have a field in a table named TK, in which a city and postcode is
entered. For example "Athens 10452" What I need is to have the postcode
10452 in another field (a new one I will create). The postcode is the last 5
characters of each entry, in every entry. So I will have "Athens" in the
field TK and "10452" in the NewField
Can someone help me?
Thanks
Jimmy
 
The Right function will give the the right-most characters.

Right([Tk], 5) will give you the last 5 characters.
 
Thanks for your answer Douglas.
But I don't quite understand. I am new in Access. I should write what
exactly and where.
Thank You
Jimmy

Douglas J. Steele said:
The Right function will give the the right-most characters.

Right([Tk], 5) will give you the last 5 characters.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



Jimmy said:
Hello I have a field in a table named TK, in which a city and postcode
is
entered. For example "Athens 10452" What I need is to have the postcode
10452 in another field (a new one I will create). The postcode is the
last 5
characters of each entry, in every entry. So I will have "Athens" in the
field TK and "10452" in the NewField
Can someone help me?
Thanks
Jimmy
 
This is how I'd handle – in your table add 2 new fields – one for the
zip code and one for the city.

To get the zipcode create an UPDATE QUERY and update ZIPCODE by
putting the following on the update to line under the ZIPCODE field of
the query:

=right([tk],5)

this will give you the zipcode

in the CITY field you will want all the characters before the zip
code, create an update query and in the UPDATE TO: LINE under city
put the following:

= Left([TK],Len([TK])-5) this will update the city field with all
left characters in the TK field less the last 5 ( the zip code).


You said you're newer to Access- then I'd make a copy of your original
file just incase something doesn't go as planned – you can always get
back to your original data.

Hope it works. -
 
Thanks a lot. Everything went well.


mar10a said:
This is how I'd handle - in your table add 2 new fields - one for the
zip code and one for the city.

To get the zipcode create an UPDATE QUERY and update ZIPCODE by
putting the following on the update to line under the ZIPCODE field of
the query:

=right([tk],5)

this will give you the zipcode

in the CITY field you will want all the characters before the zip
code, create an update query and in the UPDATE TO: LINE under city
put the following:

= Left([TK],Len([TK])-5) this will update the city field with all
left characters in the TK field less the last 5 ( the zip code).


You said you're newer to Access- then I'd make a copy of your original
file just incase something doesn't go as planned - you can always get
back to your original data.

Hope it works. -


Jimmy said:
Hello I have a field in a table named TK, in which a city and postcode
is
entered. For example "Athens 10452" What I need is to have the postcode
10452 in another field (a new one I will create). The postcode is the
last 5
characters of each entry, in every entry. So I will have "Athens" in the
field TK and "10452" in the NewField
Can someone help me?
Thanks
Jimmy
 
Back
Top