dbTalk Databases Forums  

Extracting parts of names for alphabetizing

comp.database.ms-access comp.database.ms-access


Discuss Extracting parts of names for alphabetizing in the comp.database.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bill Engel
 
Posts: n/a

Default Extracting parts of names for alphabetizing - 01-28-2004 , 08:13 AM






I use Access 2000. In my database I have a field called Full_Name
where a user is to type the full name of a contact. Consequently,
this could be filled in as "Mr. William M. Jones, III". I need a way
for the program to extract the last name (Jones) so I can alphabetize.
Does anyone know how I can do this?

Reply With Quote
  #2  
Old   
Bruce Pick
 
Posts: n/a

Default Re: Extracting parts of names for alphabetizing - 01-28-2004 , 09:30 AM






Access has a variety of string functions that you can use to analyze the
content of text fields. Depending on the # of records and your time
available, you might be able to take the existing strings apart and
spread the data out over several fields.

Suggested fields(based on Mr. Jones):
Prefix, FirstName, MiddleName, LastName, Suffix

Below I'll mention a handful of useful functions. Look them up in help
to get more complete details on each.

One function that you will likely need is IIf(), which provides an IF
logic test with 2 possible result paths.

Here's one function you will need:
QueryField: InStr(1,[Full_Name],"Mr")
will give result of 1 as that is the location of the
start of "Mr" in that record.

You can use InStr() to find the location of the space between words,
then use that value to omit the word before and show the rest, with Mid().

FoundPrefix: Mid([Full_Name],1,3)
will give "Mr.". It starts at position #1
in the field and gives 3 characters
There are also functions Left() and Right().

Wildcard characters can help in finding what you need.

Bruce Pick
++++++++++++++++++++++++++++++++++++++++++++++++++ ++++

Bill Engel wrote:
Quote:
I use Access 2000. In my database I have a field called Full_Name
where a user is to type the full name of a contact. Consequently,
this could be filled in as "Mr. William M. Jones, III". I need a way
for the program to extract the last name (Jones) so I can alphabetize.
Does anyone know how I can do this?

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.