Split Names into Two Fields

G

Guest

Table = T_TEST

Field1 = FullName
Field2 = FirstName
Field3 = LastName

Field1 has enteries
Jo Micro
Barry Soft

Field2 and Field3 are empty

Desired result

Field2
Jo
Barry

Field3
Micro
Soft

I've seen things like:
use the Update Query to update
the FirstName field to...
Left([FullName],InStr([FullName]," ")-1)
..... and update the LastName field to...
Mid([FullName],InStr([FullName]," ")+1)

I select new query, change to update, add table T_Test. Select Field =
FirstName and Table = T_TEST and added Left([FullName],InStr([FullName],"
")-1) to update to, but all I get is an error. What am I doing wrong?
 
T

tw

I set up exactly what you have here and ran it. I made the mistake at first
to copy your line exactly and I forgot to remove the carriage return in your
statement. If you've done something like that, that may be where your error
is coming from. I removed the carriage return and it worked fine.

stupid mistake I did that caused an error
Left([FullName],InStr([FullName],"
")-1)

copied the above into the update to section of the query builder

fixed it to
Left([FullName],InStr([FullName]," ")-1)

removed the cr and it worked without an error. I don't know if you message
is related but I knew that what you were doing was basically correct.
 
J

John Vinson

I select new query, change to update, add table T_Test. Select Field =
FirstName and Table = T_TEST and added Left([FullName],InStr([FullName],"
")-1) to update to, but all I get is an error. What am I doing wrong?

Please open the Query in SQL view and post the SQL text here. Also,
when you say "I get an error" it's usually considered polite to
indicate WHAT error. "Doctor, I don't feel good, what should I take?"

John W. Vinson[MVP]
 

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