Syntax for IIf Len

  • Thread starter Thread starter JIM
  • Start date Start date
J

JIM

The following is in my select statement and doesn't work:
IIf Len((Invoices.WONo = 6), Invoices.WONo As WO,Invoices.BMorR &
Invoices.WONo As WO)
I want to use WONo alone if length is 6 as WO, otherwise combine BMorR &
WONo as WO. I've tried it several ways and can't make it work. WONo can be
6 or 4 positions.
TIA
 
You can't put the "As" inside the IIf() and IIf must be followed by (.
If I understand correctly, try:

IIf(Len((Invoices.WONo = 6), Invoices.WONo,Invoices.BMorR &
Invoices.WONo) As WO
 
I think the parentheses are wrong:

IIf(Len(Invoices.WONo) = 6, Invoices.WONo,Invoices.BMorR & Invoices.WONo)
As WO
 
Thanks Duane, I got it -even with the extra paren. I just counted the left
parens and and eliminated one.
 
Back
Top