0

Please help

"string_mod_4"
John Morgen A1
Ali Zayas
Jennifer Benz A2
Desmond Michael Hall A3
Erik Remar
...

At the end of the text, I cannot remove 'A1', 'A2', etc.

they do not work

Replace([string_mod_4];"*A[123456789]";"";1)
Replace([string_mod_4];"*A?";"";1)
Replace([string_mod_4];"*A#";"";1)
1

1 Answer 1

1

Consistency of structure is critical in string manipulation.

Assuming there is an A preceding a single digit at end of string (when present at all), consider:

Trim(IIf(x LIKE "*A#", Replace(x, Right(x, 2), ""), x))

Any variation from that assumption will complicate.

If the field is Null, expression will error. In a query, one way to handle that possibility:
IIf(Not x Is Null, Trim(IIf(x LIKE "*A#", Replace(x, Right(x, 2), ""), x)))

RegEx could be more flexible and compact but has a fairly steep learning curve. Also, AFAIK cannot be called directly in query. Would have to build a custom function to perform manipulation and return value. Review Microsoft office Access `LIKE` VS `RegEx`

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.