Trouble with Syntax

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In advance, thanks for your help. What I want to do is test a field called
cost or Net and when it contains "cost", I want to further analyize two other
fields. One field is the country and the other is a sales order type. When
that condition is true, I then want to divide the cost by 10. If the Cost or
Net field contains Net, I then want to use the net price. Here is the
statement I have generated but am getting a syntax error. Your input is
greatly appreciated.

Unit Value: IIf([Cost or Net]="Cost" And [Country]="MX" And
[SalesDocType]="YEKL",(([Unit Cost]/10),[Unit Cost]),[Net Unit Price])

Randy
 
You have too many options in the IIF statement. You can only have two
options for on IIF.
Perhaps you want to nest a second IIF or use the Switch function.


Unit Value: IIf([Cost or Net]="Cost" And [Country]="MX" And
[SalesDocType]="YEKL",[Unit Cost]/10,
IIF([Cost Or Net] = "Cost",[Unit Cost],[Net Unit Price]))

I am guessing as I found your explanation slightly ambiguous.
 
John,

Thanks for your help. It works great.

Randy

John Spencer said:
You have too many options in the IIF statement. You can only have two
options for on IIF.
Perhaps you want to nest a second IIF or use the Switch function.


Unit Value: IIf([Cost or Net]="Cost" And [Country]="MX" And
[SalesDocType]="YEKL",[Unit Cost]/10,
IIF([Cost Or Net] = "Cost",[Unit Cost],[Net Unit Price]))

I am guessing as I found your explanation slightly ambiguous.


Randy said:
In advance, thanks for your help. What I want to do is test a field called
cost or Net and when it contains "cost", I want to further analyize two
other
fields. One field is the country and the other is a sales order type.
When
that condition is true, I then want to divide the cost by 10. If the Cost
or
Net field contains Net, I then want to use the net price. Here is the
statement I have generated but am getting a syntax error. Your input is
greatly appreciated.

Unit Value: IIf([Cost or Net]="Cost" And [Country]="MX" And
[SalesDocType]="YEKL",(([Unit Cost]/10),[Unit Cost]),[Net Unit Price])

Randy
 
Back
Top