IIf STATEMENT - MS QUERY (1 Viewer)

lwarren1968

Registered User.
Local time
Today, 04:07
Joined
Jan 18, 2013
Messages
77
I have an express below that works well when the data meets the specified criteria. However, I need all data to be returned not just those adjusted based on the expression below. What am I missing?


Expr2: IIf(Len([Expr1])=13,Left([Expr1],12),IIf(Len([Expr1])=12,Left([Expr1],11)))
 

theDBguy

I’m here to help
Staff member
Local time
Today, 04:07
Joined
Oct 29, 2018
Messages
21,455
Hi. I'm not sure I understand, but maybe try this?


Expr2: IIf(Len([Expr1])=13,Left([Expr1],12),IIf(Len([Expr1])=12,Left([Expr1],11),[Expr1]))
 

lwarren1968

Registered User.
Local time
Today, 04:07
Joined
Jan 18, 2013
Messages
77
That is exactly what I needed. Works perfectly. Thank you!
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 19:07
Joined
May 7, 2009
Messages
19,230
to simplify your IIFs:

Expr2: IIf(Len([Expr1])>11, Left([Expr1],LEN([Expr1])-1), [Expr1])
 

Users who are viewing this thread

Top Bottom