Delete one character from a text field

G

Guest

I receive a table with a field containing lastnames with a first name initial
(For instance: "BakerK") I want to strip off the first name initial and show
only the last name in a query. I know I can use =Right([lastname],1) to
return the last character on the right, but how do I delete it?
 
K

Ken Snell [MVP]

Use an update query with a slightly different approach:

UPDATE TableName
SET [FieldName] = Left([FieldName], Len([FieldName]) - 1);
 
G

Guest

This will return the name only
=left("BekerK",len("BekerK")-1)

To use it in a select query, try this

Select NameField , left(NameField ,len(NameField )-1) As LastName From
TableName

To update the table, but you don't need becuase you can get the resault
using a select query.
Back up first

UPDATE TableName SET TableName.FieldName= Left([FieldName],Len([FieldName])-1)
 

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