1 field into 2 fields

dorodon

Registered User.
Local time
Today, 21:58
Joined
Aug 17, 2004
Messages
17
I have a table with a field for the complete name of a person (for instance "John Walker") and I want to make a query to divide that field into 2 new fields: "Name" and "Surname", that is, "John" and "Walker".

How to do it?

Thanks in advance
 
i dont quite understand..
why dont you just edit your table.. and do an insert if thats what you need to do.. you cant "split" fields through a query.. umm yeah.. i dont really understand though..

explain more..
 
Add two new fields to your table: Forename and Surname.

Open a query, switch to SQL View and copy and past this SQL in.

UPDATE MyTable SET Forename = Left([NameField], InStr(1, [NameField], " ")-1), Surname = Mid([NameField], InStr(1, [NameField], " "(+1);

Change MyTable to the name of your table.
Change NameField to the name of your current field.
I've named the field Forename and not Name as Name is a reserved word in Access.
 

Users who are viewing this thread

Back
Top Bottom