A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Parsing name



 
 
Thread Tools Display Modes
  #1  
Old March 24th, 2010, 01:33 PM posted to microsoft.public.access
Song[_4_]
external usenet poster
 
Posts: 43
Default Parsing name

How to extract LastName, FirstName, MI? (Not all with MI). Sample
names:

John Doe
John M Doe

Thanks
  #2  
Old March 24th, 2010, 01:53 PM posted to microsoft.public.access
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default Parsing name

Unfortunately, there's no simple answer. Sometimes the first name is two
parts and sometimes the last name is (Mary Lou Retton, Ludwig von
Beethoven). Sometimes there's only a first name. (Pele, Cher)

Realistically, you're likely going to USB (use someone's brain)

--
Doug Steele, Microsoft Access MVP
http://www.AccessMVP.com/DJSteele
(no e-mails, please!)

"Song" wrote in message
...
How to extract LastName, FirstName, MI? (Not all with MI). Sample
names:

John Doe
John M Doe

Thanks



  #3  
Old March 24th, 2010, 01:58 PM posted to microsoft.public.access
Allen Browne
external usenet poster
 
Posts: 11,706
Default Parsing name

See:
http://allenbrowne.com/func-10.html

To get the first word from YourField, use:
ParseWord([YourField], 1)

To get the last word, use:
ParseWord([YourField], -1)

The middle name won't be as easy: Instr(), Mid(), and Len() may help.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Song" wrote in message
...
How to extract LastName, FirstName, MI? (Not all with MI). Sample
names:

John Doe
John M Doe

Thanks


  #4  
Old March 24th, 2010, 02:01 PM posted to microsoft.public.access
Stefan Hoffmann
external usenet poster
 
Posts: 991
Default Parsing name

On 24.03.2010 14:33, Song wrote:
How to extract LastName, FirstName, MI? (Not all with MI).


http://support.microsoft.com/kb/168799

Caveat: Every known way to parse a string into names is error prone.

http://stackoverflow.com/questions/1...omponent-parts

There are two basic problems:

1) You cannot rely on order. You have always a cause for distrust on
user input.

2) There are weird names out there in the wild. Especially there are
surnames consisting of two or more words only separated by spaces.

So in short: It's a NP-hard task... okay not really, you only need a
really large rainbow table with approximately 6 billion names. With
reduction it will be smaller than that but still large enough


mfG
-- stefan --
  #5  
Old March 24th, 2010, 04:03 PM posted to microsoft.public.access
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Parsing name

As pointed out by others, not a simple task. And I'll add folks who add ",
Jr.", ", Senior", and ", III" to their names.

You can try using Left(), Right(), Mid(), and Instr() functions to start
with, then perform a final validation using someone's brain.

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Song" wrote in message
...
How to extract LastName, FirstName, MI? (Not all with MI). Sample
names:

John Doe
John M Doe

Thanks



 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.