Syntax for IIf Len

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
 
D

Duane Hookom

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
 
D

Douglas J. Steele

I think the parentheses are wrong:

IIf(Len(Invoices.WONo) = 6, Invoices.WONo,Invoices.BMorR & Invoices.WONo)
As WO
 
J

JIM

Thanks Duane, I got it -even with the extra paren. I just counted the left
parens and and eliminated one.
 

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


Top