Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting lastname and filling rest with blanks.

Status
Not open for further replies.

Hillbillie

IS-IT--Management
Jun 28, 2005
23
US
I have this table with a name field. Unfortunately it has the lastname and first name together. Here is an example.

Bateman, Ramey
Bell, Leroy
Schremmer, Stephanie

All records have the comma and space.

I want to have an update query that will take the last name and make it like this.

The last names will go into a seperate category called last name.

"Bateman "
"Bell "
"Schremmer "

Notice, that it gets the last name and fills the remaining with space. The field length must be 40.

I need to do the same with the first name too.
Thanks,
 
Something like this (SQL code)?
UPDATE yourTable
SET LastName=Left(Left(yourNameField,InStr(yourNameField,',')-1) & Space(40),40)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top