Select Data

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

Guest

Is there a way to use the LEFT() function to take all the characters until a
space is encountered?

I am trying to normalize data I imported from another program and the City
State and zip are all in one field there are no comma's.

I used Right() function to get the 5 digit zip code.

example
Honolulu Hi 96740
 
You can find the space with an expression like:
Instr([CityStateAndZip], " ")
Use this with Left() to get everything left of the space.
 
Watch out for city names like New Orleans, New York, St. Claire, Sioux City,
North Platte, etc.

IF (very important word) your fields always contain City Name, space,
2-Character State Code, space, and a 5 digit zip. Such as
New York NY 12345

City:MID([YourField],1,Len([YourField])-9)

State: MID([YourField],Len([YourField])-8,2)

Zip: You've already figured out.

Duane said:
You can find the space with an expression like:
Instr([CityStateAndZip], " ")
Use this with Left() to get everything left of the space.

--
Duane Hookom
MS Access MVP

Stefan said:
Is there a way to use the LEFT() function to take all the characters until
a
space is encountered?

I am trying to normalize data I imported from another program and the City
State and zip are all in one field there are no comma's.

I used Right() function to get the 5 digit zip code.

example
Honolulu Hi 96740
 

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