Replacing part of a field after a space.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to replace part of a field after a space. For example:

Cindy Jones would be Cindy
Tom Price would be Tom
John Smith III would be John
 
Do you want to replace the entire field or just retrieve the part?

REPLACE (caution save a backup of your data, this is not undoable)

UPDATE [YourTableName]
SET [YourFieldName] = Trim(Left([YourFieldName], Instr(1,[YourFieldName] & "
"," ")))
WHERE [YourFieldName] is not null

To just show the value in a calculated field
Field: JustFirstName: Trim(Left([YourFieldName], Instr(1,[YourFieldName] & "
"," ")))
 
I wanted to retrieve the field. Thank You. This is exactly what I needed.

John Spencer said:
Do you want to replace the entire field or just retrieve the part?

REPLACE (caution save a backup of your data, this is not undoable)

UPDATE [YourTableName]
SET [YourFieldName] = Trim(Left([YourFieldName], Instr(1,[YourFieldName] & "
"," ")))
WHERE [YourFieldName] is not null

To just show the value in a calculated field
Field: JustFirstName: Trim(Left([YourFieldName], Instr(1,[YourFieldName] & "
"," ")))

Courtney said:
I would like to replace part of a field after a space. For example:

Cindy Jones would be Cindy
Tom Price would be Tom
John Smith III would be John
 

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

Back
Top