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
 
Back
Top