?
Solved

Get text before space in access

Posted on 2009-04-02
4
Medium Priority
?
329 Views
Last Modified: 2012-05-06
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
Comment
Question by:mattturley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 22

Expert Comment

by:Flyster
ID: 24051837
Left(Last.First,Len(Last.First," ")-1)

Flyster
0
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 24051863


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

mx
0
 
LVL 75
ID: 24051891
Exmaple

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

returns

joe,

including the comma.

mx
0
 
LVL 22

Expert Comment

by:Flyster
ID: 24051973
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question