Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deleting specific word from a field 1

Status
Not open for further replies.

goslincm

MIS
May 23, 2006
292
US
I have a field called [Official Name] and in that field are the names of various cities followed by the word CITY. Is there a way to just delete the word city while keeping the name of the city which is to the left of the word city?
 
Trim(Left([yourField],InStr([yourField],' CITY')))

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
when I typed: Replace(Name, 'city'")

get error indicating: the expression you entered has an invalid string.
 
you missed a comma...
but as always PHV suggestion is the best...
-DNG
 
Actually when I run this query I don't see where a comma is missing, but my results remove the "ity" of the word city, still leaving the "c" out there. How can I get rid of the whole word city? I've tried using both upper and lower case C.
 


Left$([Official Name], InStr([Official Name], "city") - 1)
 
Seems you missed the space before CITY in my post stamped 28 Jul 06 16:36.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top