Parse Suffix from Last Name Field

B

Bill B.

I have a last name field where the suffix like JR, SR, III, II, etc is part
of the data. How can I parse the suffix and leave the last name? TIA
 
J

John W. Vinson

I have a last name field where the suffix like JR, SR, III, II, etc is part
of the data. How can I parse the suffix and leave the last name? TIA

Not easily: what if you have LastName values like "de la Torre" or "von
Beethoven"?

You could use expressions like

NewLast: Left(([lastname] & " ", InStrRev([lastname] & " ", " ") - 1)
Title: Mid([lastname] & " ", InStrRev([lastname] & " ", " ") + 1)

to extract the last "word" in the name, but this (as written) will put "de la
" and "von" in the new last name, and "Torre" or "Beethoven" into the suffix
field.

You could use a criterion such as

LIKE "* JR" OR LIKE "* SR" OR LIKE "* II" and so on using all the possible
suffixes.
 
K

KARL DEWEY

Assuming they were loaded uniformally, build a table of suffixes with a
totals-make table query.

SELECT Trim(Right(YourTable.[LastName],3)) AS Suffix INTO SuffixList
FROM YourTable
GROUP BY Trim(Right(YourTable.[LastName],3));

Then run an update on new Suffix field in your table using
SuffixList.[Suffix] as criteria on calculated field -
Trim(Right(YourTable.[LastName],3))

If they were not uniform -- Jr, JR., Sr, Sr., 2nd, II, III, 3rd, etc - then
add another field to the SuffixList to put standard suffix and then use it
for update.

Lastly update the LastName field with --
Trim(Left([LastName],
Len([LastName])-Len(Trim(Right(YourTable.[LastName],3)))))
 

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

Similar Threads

Parsing Query 4
Extracting and Separating Names in Access Query 2
splitting a name field 3
Query File As 6
Parameter Query 2
breakdown adresses into separate fields 1
Splitting Text Field 1
Update Query 5

Top