Extracting a last name from a field

M

Michelle

I inherited a database which has several hundred records.
It has a "Name" field with a person's title, first, and
last names separated by a space. Is there any way I can
extract just the last name from that field so that I can
sort the data by last name?
Thanks in advance.
 
G

GVaught

This is a four step process.
1st: Title: Left([Name],InStr([Name]," ")-1)
LName: Mid([Name],InStr([Name]," ")+1)
First: Left([Lname],InStr([Lname]," ")-1)
Last: Mid([LName],InStr([LName]," ")+1)

Use the above within a query using the table that contains "Name".
 
M

Michelle

Thanks. That worked!

-----Original Message-----
This is a four step process.
1st: Title: Left([Name],InStr([Name]," ")-1)
LName: Mid([Name],InStr([Name]," ")+1)
First: Left([Lname],InStr([Lname]," ")-1)
Last: Mid([LName],InStr([LName]," ")+1)

Use the above within a query using the table that contains "Name".

I inherited a database which has several hundred records.
It has a "Name" field with a person's title, first, and
last names separated by a space. Is there any way I can
extract just the last name from that field so that I can
sort the data by last name?
Thanks in advance.


.
 
T

Tom Wickerath

If you run into trickier situations in the future, try using Splitter for Microsoft
Access. I have this add-in utility, and it does a wonderful job.

http://www.infoplan.com.au/splitter/

Tom
_________________________________________


Thanks. That worked!

_________________________________________



This is a four step process.
1st: Title: Left([Name],InStr([Name]," ")-1)
LName: Mid([Name],InStr([Name]," ")+1)
First: Left([Lname],InStr([Lname]," ")-1)
Last: Mid([LName],InStr([LName]," ")+1)

Use the above within a query using the table that
contains "Name".

_________________________________________

message
I inherited a database which has several hundred records. It has a "Name" field with a
person's title, first, and last names separated by a space. Is there any way I can
extract just the last name from that field so that I can sort the data by last name?

Thanks in advance.
 

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

Top