473,387 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Seperate first and last name

Good Day all
I have a single field that has both the first and last names in it.
In some records we even have a middle initial.
I was thinking of using the Left (Fullname,XX) function to get the first
name but as all the names have different lenghths up to the first space
between names, I need to replace the XX which tells the function to go as
far as the first space only.
Please point me in the right direction.
Thanks

Feb 12 '07 #1
4 3026
Just from the top of my head: I think you should have a look at the
Pos function --- you can use it to determine the position of the first
space. Also, one tip that might be handy: you can try these things out
in the "Direct" window in the VBA editor (press Ctrl+G to show it).

Good luck!

Yours sincerely,
Onno Broekmans

Feb 12 '07 #2
Hi John,

Try:

Forename = Left([fullName],InStr([fullName]," "))

Surname = Right([fullName],Len([fullName])-InStr([fullName]," "))

Cheers - David

Feb 12 '07 #3
On 12 Feb 2007 05:17:17 -0800, "Daveo" <wr**********@gmail.comwrote:
>Hi John,

Try:

Forename = Left([fullName],InStr([fullName]," "))

Surname = Right([fullName],Len([fullName])-InStr([fullName]," "))

Cheers - David
I usually use the Split command in VB for this.

If you split on a space, the function will return an array of
substrings. Depending on the name, you will get different string
counts.

Examples:
Fred Smith

Fred Von Smith

Fred Smith, Jr.

Fred Von Smith, Jr.

You may have to do a little work with your array but once you get the
names fixed you will be a lot better off.

Nothing like doing a search for "Bill Smith" and find that his reall
name is John but people have called him Bill for so long that it just
stuck except that your database has John. - This story is adapted
from a real life situation.

Bill

Feb 12 '07 #4
Thanks Guys
As usual the response from this group is awesome.
Feb 12 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: TonyB | last post by:
Hi, I've searched the group and need more information and guidance on this issue I need to resolve next week. I work for the local school system and I am working on a way to parse a CSV file of...
1
by: Prasad Karunakaran | last post by:
I am using the C# DirectoryEntry class to retrieve the Properties of an user object in the Active Directory. I need to get the First Name and Last Name as properties. I know it is not supported...
1
by: bin_P19 P | last post by:
the code i have got is as follows and now im stuck <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Shopping...
6
by: Brad Britton | last post by:
Just wondering how you would break a string such as first and last name together, into two separate strings or variables, each containing the firstName and lastName. I am a newbie at C# so any help...
32
by: James Curran | last post by:
I'd like to make the following proposal for a new feature for the C# language. I have no connection with the C# team at Microsoft. I'm posting it here to gather input to refine it, in an "open...
1
by: rloef | last post by:
I have a multi-million row table with three indexes in MySQL-5.0.15. These indexes have the following number of distinct values: date 415 block 100000 scan 45 If I'm doing a query...
3
by: daan | last post by:
Hello, I have a problem and I can't get the solution for it :( I have a com dll, which i imported as a reference. The com object is part of a class which is multithreaded and will create...
0
by: bloukopkoggelmander | last post by:
Hi All wonderfull brains! Right I have two questions after my last very successfull thread. I have tried looking these up on the net, but no luck. Scenario 1 is : I have a bound form with bound...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.