Replacing part of a field after a space.

C

Courtney

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
 
J

John Spencer

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] & "
"," ")))
 
C

Courtney

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
 
Top