Link to home
Start Free TrialLog in
Avatar of Listrite
ListriteFlag for Canada

asked on

Split a field based on first occuring space from left and . . .

Hi,

I have a field where I want to extract the all characters that are left of the first occurring space.  But I also want to extract the characters if there is no space in the field.

So for example.  I have created a field that I call, "FirstPart"  In it I want information taken from a field called "First":

Field: First
Record 1: Jim K.
Record 2: Susan

When I run an update query to the FirstPart field; Left([First],InStr([First]," ")-1)

I get:

Field: FirstPart
Record 1: Jim K.
Record 2: (blank)

I experimented with used Mid and Instrrev, but not getting any results.  That would be due to my inexperience in using those functions.

Any thoughts?

Thanks,

Peter
Avatar of Jeffrey Coachman
Jeffrey Coachman
Flag of United States of America image

Questions like these are typically dependent on being able to handle each and every data entry inconsistency.

What is there is no name? (blank, Null)
What if there is no space.
...etc
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Listrite

ASKER

Thanks Jim and Capricorn,

Tried both solutions and they worked great.  So with that in mind, couldn't really choose which to select as the "Best Solution"

boag2000: Thanks for your reply.  The only requirement I had was to retrieve information in records that had information in the First field.  So any nulls, blanks, did not matter in this case.

Peter