First, middle and last name

DavyLad

New member
Local time
Today, 06:32
Joined
Jan 3, 2008
Messages
5
I have a list if names, some with a middle initial and some without, that are all in one field. eg George P Wingrove or Ada Wingrove. Can I run a query that will seperate the name into two or three fields? I have tried the following in a query, but not being very successful. FirstName:Left([Name],InStr(1,[Name]," ")-1), MiddleInitialTrim(Mid([Name],InStr(1,[Name]," ")+1,InStr(InStr (1, [Name], " ")+1,[Name]," ")-InStr(1,[Name]," "))) and LastName:IIf(InStr(InStr([Name]," ")+1,[Names]," ") <>0, Right([name],Len([name])-InStr(InStr([Name]," ")+1,[Name]," ")),Right([Name],Len([Name])-InStr([Name]," ")))
Unfortunately, it puts #Error if there is no middle initial. Any way round this problem?

David
 
You will have to write a custom VBA function to parse the data.
 
Names are always tricky. What if you have a William P van der Post?
 
If there is more than just the 2 names can be tested for

If instr(field," ") = instrrev(field," ") then there is only the 2 names, but as Keith said you are best writing a function, I think there may be one somewhere in the forum as similar questions have been asked.

Brian
 
Thanks all, I will have a look to try to find it.

David
 

Users who are viewing this thread

Back
Top Bottom