469,304 Members | 1,759 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,304 developers. It's quick & easy.

split field name into two

I have table, ex Servicenumber, Serviceplace and ContactPerson.
I want to split Contactperson into Firstname and LastName. They are seperated by space in ContactPerson field.

can somebody help me?
Nov 27 '06 #1
5 9170
I'm sure one of the guru's in here can help you do this with MS Access, however one solution would be to export or cut and paste that field's data into a text file then import it into excel as a space deliminated file.

That means it will interpret any spaces as a tab and break up the first and last names into seperate colums. Then you could import that back into your database (or cut and paste it back).

Cheers,
Cz.
Nov 27 '06 #2
nico5038
3,080 Expert 2GB
You can add the two needed fields to the table and use a query like:

update tblNames set FirstName = left(fullname,instr(fullname," ")-1), LastName = Mid(fullname,instr(fullname," ")+1);

Now the fields will be filled and the fullname field can be removed, but remember that not all names have two parts...

Nic;o)
Nov 27 '06 #3
PEB
1,418 Expert 1GB
If you want to create a special function....

See how you can use the function split(expression, delimiter)

It isn't for direct use directly from query, coz it returns an array...

But if u create your own function that gets an entry from the array this can be done!
Nov 27 '06 #4
Thank you everyone :)
With help from you all I managed it.

But i cant make any change in the tables yet.(big system).
One time I have to rebuild it all ;P It so fucked up system.
Nov 27 '06 #5
NeoPa
32,173 Expert Mod 16PB
Don't forget to make a back-up copy of your database before making any fundamental changes like this.
Good luck.
Nov 27 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Arjen | last post: by
2 posts views Thread by SL_McManus | last post: by
4 posts views Thread by William Stacey [MVP] | last post: by
12 posts views Thread by garyusenet | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.