• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 337
  • Last Modified:

Get text before space in access

I have a field formatted like the following:

last.first (last, first mi)

I need to get just the last.first portion (everything before the first space).  

What's best way to do this?

Thanks,
Matt
0
mattturley
Asked:
mattturley
  • 2
  • 2
1 Solution
 
FlysterCommented:
Left(Last.First,Len(Last.First," ")-1)

Flyster
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:


Left(LastFirst,Instr(1, LastFirst," ")-1)

mx
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Exmaple

Left("joe, jammer",Instr(1, "Joe, Jammer"," ")-1)

returns

joe,

including the comma.

mx
0
 
FlysterCommented:
DatabaseMX is correct. I meant to use Instr instead of Len.
Left([Last.First],InStr([Last.First]," ")-1)

If you don't want the comma to show, change the -1 to -2.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now