truncating characters from string of variable length

J

john rodgers

Hello
In Access 2000, I need to remove the last nine characters from text
strings of variable length (need to remove zip and state from city
names of varying length). It seems neither the Left, Mid, or Rright
functions will help me. I already used Right to create a new field
containing the zip and state, but how can I now create a field
containing only the city.

Another trick here is that many of the city names have spaces in them,
so I cant use a function that relies on the space as a delimiter. The
only key I can think of is that the number of characters I want to
remove is fixed.

Thank you very much for any help you can offer.
John
 
G

Gary Miller

John,

If I understand correctly, the strings are of variable
length but you always want to strip the last nine characters
off. If that is right, try the following

Left(strYourString,Len(strYourString - 9)

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 
J

John Spencer (MVP)

One small correction, one missed closing parentheses.

Left(strYourString,Len(strYourString)-9)
 
G

Gary Miller

You are too good! Thanks.

Gary

--

Gary Miller
Gary Miller Computer Services
Sisters, OR
________________________
 

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

Top