Need help using query to remove salutations

gojets1721

Registered User.
Local time
Today, 04:04
Joined
Jun 11, 2019
Messages
430
So I have a query that is removing salutations in a name field and have the below code. It removes everything from the comma and onward (so , Mr for instance)

Expr1: Left([user last name],InStr(1,[user last name],",")-1)

It works great to remove the salutations. However, if a name doesn't have a salutation, I'm getting a '#Func!' error.

Any ideas how to fix that?
 
You might need to wrap the whole thing in an IIF statement to test if it has the comma.

Is it really a comma that ends an abbreviation??
 
Not really cross-posted but a weird continuation of this thread https://www.accessforums.net/showthread.php?t=83091

Expr1: IIf (InStr(1,[user last name],",")=0, [User Last Name], Left([user last name],InStr(1,[user last name],",")-1))
No it is a crosspost from here https://www.accessforums.net/showthread.php?t=83091

In fact I answered this question at 15:31, the o/p replied at 15:34 and then posted here. :(
Plus the code the o/p posted came from me? :unsure:

So that is me out.
 

Users who are viewing this thread

Back
Top Bottom