Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested IIF Statements

Status
Not open for further replies.

Lanie

Programmer
Jan 20, 2000
83
US
I have a calculating, unbound control that I am trying to get if statements (nested) to work in.<br><br>This is my problem....the first works fine, the second works fine and it will be me the qty * the unitprice correctly.&nbsp;&nbsp;However, the third statement (AR) gives me an error.<br>#1 - Works great<br><br>=IIf(CharSearch([qty],&quot;-&quot;),&quot; &quot;,IIF(
Code:
=”Lot”,[unitprice],[qty]*[unitprice])<br><br>#2 - At &quot;ar&quot; gives error, otherwise works<br><br>=IIf(CharSearch([qty],&quot;-&quot;),&quot; &quot;,IIF([code]=”Lot”,[unitprice], ],IIf([Code]=&quot;AR&quot;,[UNITPRICE],&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[qty]*[unitprice])))<br><br>#3 - did this when I thought I was on the right track.<br><br>My original code was:&nbsp;&nbsp;=IIf(CharSearch([qty],&quot;-&quot;),&quot; &quot;,IIf([Code]=&quot;LOT&quot;,[UNITPRICE],IIf([Code]=&quot;AR&quot;,[UNITPRICE],IIf([Code]=&quot;LOTNSP&quot;,&quot;NSP&quot;,IIf([Code]=&quot;NSP&quot;,&quot;NSP&quot;,IIf([Code]=&quot;TBD&quot;,&quot;TBD&quot;,IIf([Code]=&quot;NC&quot;,&quot;N / C&quot;,IIf([Code]=&quot;Title&quot;,&quot; &quot;,[QTY]*[UNITPRICE]))))))))<br><br>But I had to take it appart to see where the errors are. I am not very familiar with working this at all and could use your expertise here.&nbsp;&nbsp;Do I have too many nested statements or just what is my problem with this?<br><br>Yes, the (CharSearch) is in a module (created by someone else)and works well.<br><br>Thanks in advance for all your help. <p>Lanie<br><a href=mailto:etroidl@conaxfl.com>etroidl@conaxfl.com</a><br><a href= > </a><br>
 
you can nest as many IIf's as you can keep track of, which in my case sometimes is a negative number.<br><br>did you copy these directly, or did you retype them?<br><br>and you're saying you want to get the 3rd one to work, or just to the 2nd level part? <p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
=IIf(CharSearch([qty],&quot;-&quot;),&quot; &quot;,IIF(
Code:
=”Lot”,[unitprice], IIf([Code]=&quot;AR&quot;,[UNITPRICE], [qty]*[unitprice])))<br><br>this should make the second part work (given field names are correct) <p>Brian Famous<br><a href=mailto:bfamous@ncdoi.net>bfamous@ncdoi.net</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top