Splitting fields into two for first and last name

C

ChuckW

Hi,

I have about 1000 names in a field called full name.
Most have first and last name but some have a middle
initial with a period as well. What I would like to do
is to split these into either two or three fields. Is
there are way to split out a field every time there is a
space? What I eventually want to end up with is a field
for first and last name and to simply delete the middle
initial.

Thanks,

Chuck
 
E

Eric Butts [MSFT]

Hi Chuck,

Take a look at the following:

ACC2000: How to Parse Comma-Separated Text into Multiple Fields (210588)
http://support.microsoft.com/default.aspx?scid=KB;EN-US;210588

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support
(e-mail address removed)
"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."

This posting is provided "AS IS" with no warranties, and confers no rights



--------------------
| Content-Class: urn:content-classes:message
| From: "ChuckW" <[email protected]>
| Sender: "ChuckW" <[email protected]>
| Subject: Splitting fields into two for first and last name
| Date: Mon, 16 Aug 2004 14:06:18 -0700
| Lines: 14
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcSD1N+X4/44kqO2Rb23lw1PXnRgcA==
| Newsgroups: microsoft.public.access.queries
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.access.queries:210239
| NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
| X-Tomcat-NG: microsoft.public.access.queries
|
| Hi,
|
| I have about 1000 names in a field called full name.
| Most have first and last name but some have a middle
| initial with a period as well. What I would like to do
| is to split these into either two or three fields. Is
| there are way to split out a field every time there is a
| space? What I eventually want to end up with is a field
| for first and last name and to simply delete the middle
| initial.
|
| Thanks,
|
| Chuck
|
 
J

John Spencer (MVP)

If this is a one time thing, the easiest way to do this is in stages.

Add two new fields - FirstName and LastName

First Pass

UPDATE YourTable
Set FirstName = Trim(Left(FullName,Instr(1,FullName," "))),
LastName = Trim(Mid(FullName,Instr(1,FullName," ")))
WHERE FullName Like "* *"

That should give you the first part fo FullName in FirstName and the remainder
in LastName.

Second Pass:

UPDATE YourTable
Set LastName = Trim(Mid(LastName,Instr(1,LastName," ")))
WHERE LastName Like "* *"

Strip out any extra parts (initials).

NOW, you are very likely to have errors with this method. Such as

Mary Anne Brubecker --> Mary | Brubecker
Richard Van Allen --> Richard | Allen
James Mac Kenzie --> James | Kenzie

Hope this helps
 

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