IIf Statements

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

Guest

I am trying to combine two IIf statements
Expr1:
IIf([tblItemListVendor]![PricePerLbOrCs]="Lbs",[tblCurrentPrice]![LastOfItem
Price]/16)
And
Expr2:
IIf([tblItemListVendor]![PricePerLbOrCs]="Case",[tblCurrentPrice]![LastOfItem
Price]/[tblItemListVendor]![NetWeight]/16)
i want to have this info in one column instead of two
Can anyone help?
 
LbsCase:
IIf([tblItemListVendor]![PricePerLbOrCs]="Lbs",[tblCurrentPrice]![LastOfItem
Price]/16,
IIf([tblItemListVendor]![PricePerLbOrCs]="Case",[tblCurrentPrice]![LastOfItem Price]/[tblItemListVendor]![NetWeight]/16,0))

If the PricePerLbOrCs field is neither Lbs or Case, then it returns a 0.
 
Switch(
[tblItemListVendor!PricePerLbOrCs="Lbs",tblCurrentPrice!LastOfItemPrice/16,
tblItemListVendor!PricePerLbOrCs="Case",tblCurrentPrice!LastOfItemPrice/tblItemListVendor!NetWeight/16)



Hoping it may help,
Vanderghast, Access MVP
 
Lisa said:
I am trying to combine two IIf statements
Expr1:
IIf([tblItemListVendor]![PricePerLbOrCs]="Lbs",[tblCurrentPrice]![LastOfItem
Price]/16)
And
Expr2:
IIf([tblItemListVendor]![PricePerLbOrCs]="Case",[tblCurrentPrice]![LastOfItem
Price]/[tblItemListVendor]![NetWeight]/16)
i want to have this info in one column instead of two
Can anyone help?

Put one inside the other:

IIf([tblItemListVendor]![PricePerLbOrCs]="Lbs",[tblCurrentPrice]![LastOfItem Price]/16,IIf([tblItemListVendor]![PricePerLbOrCs]="Case",[tblCurrentPrice]![LastOfItemPrice]/[tblItemListVendor]![NetWeight]/16, "Invalid value"))HTH;Amy
 
Typo error, remove one [ .

The syntax of Switch is:

SWITCH( condition1, value1, condition2, value2, ..., ... )


and returns the value associated to the first condition that evaluates to
true.


SWITCH( a1, b1, a2, b2, ... , ..., true, z )

would return z if no other condition is true.



Vanderghast, Access MVP


Michel Walsh said:
Switch(
[tblItemListVendor!PricePerLbOrCs="Lbs",tblCurrentPrice!LastOfItemPrice/16,

tblItemListVendor!PricePerLbOrCs="Case",tblCurrentPrice!LastOfItemPrice/tblItemListVendor!NetWeight/16)



Hoping it may help,
Vanderghast, Access MVP



Lisa said:
I am trying to combine two IIf statements
Expr1:
IIf([tblItemListVendor]![PricePerLbOrCs]="Lbs",[tblCurrentPrice]![LastOfItem
Price]/16)
And
Expr2:
IIf([tblItemListVendor]![PricePerLbOrCs]="Case",[tblCurrentPrice]![LastOfItem
Price]/[tblItemListVendor]![NetWeight]/16)
i want to have this info in one column instead of two
Can anyone help?
 
That only returns my per case values not my per lbs values.
--
Lisa S.


Jerry Whittle said:
LbsCase:
IIf([tblItemListVendor]![PricePerLbOrCs]="Lbs",[tblCurrentPrice]![LastOfItem
Price]/16,
IIf([tblItemListVendor]![PricePerLbOrCs]="Case",[tblCurrentPrice]![LastOfItem Price]/[tblItemListVendor]![NetWeight]/16,0))

If the PricePerLbOrCs field is neither Lbs or Case, then it returns a 0.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Lisa said:
I am trying to combine two IIf statements
Expr1:
IIf([tblItemListVendor]![PricePerLbOrCs]="Lbs",[tblCurrentPrice]![LastOfItem
Price]/16)
And
Expr2:
IIf([tblItemListVendor]![PricePerLbOrCs]="Case",[tblCurrentPrice]![LastOfItem
Price]/[tblItemListVendor]![NetWeight]/16)
i want to have this info in one column instead of two
Can anyone help?
 
Thanks it works

--
Lisa S.


Amy Blankenship said:
Lisa said:
I am trying to combine two IIf statements
Expr1:
IIf([tblItemListVendor]![PricePerLbOrCs]="Lbs",[tblCurrentPrice]![LastOfItem
Price]/16)
And
Expr2:
IIf([tblItemListVendor]![PricePerLbOrCs]="Case",[tblCurrentPrice]![LastOfItem
Price]/[tblItemListVendor]![NetWeight]/16)
i want to have this info in one column instead of two
Can anyone help?

Put one inside the other:

IIf([tblItemListVendor]![PricePerLbOrCs]="Lbs",[tblCurrentPrice]![LastOfItem Price]/16,IIf([tblItemListVendor]![PricePerLbOrCs]="Case",[tblCurrentPrice]![LastOfItemPrice]/[tblItemListVendor]![NetWeight]/16, "Invalid value"))HTH;Amy
 
Thank you I re-copied it and it works great .
--
Lisa S.


Jerry Whittle said:
LbsCase:
IIf([tblItemListVendor]![PricePerLbOrCs]="Lbs",[tblCurrentPrice]![LastOfItem
Price]/16,
IIf([tblItemListVendor]![PricePerLbOrCs]="Case",[tblCurrentPrice]![LastOfItem Price]/[tblItemListVendor]![NetWeight]/16,0))

If the PricePerLbOrCs field is neither Lbs or Case, then it returns a 0.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

Lisa said:
I am trying to combine two IIf statements
Expr1:
IIf([tblItemListVendor]![PricePerLbOrCs]="Lbs",[tblCurrentPrice]![LastOfItem
Price]/16)
And
Expr2:
IIf([tblItemListVendor]![PricePerLbOrCs]="Case",[tblCurrentPrice]![LastOfItem
Price]/[tblItemListVendor]![NetWeight]/16)
i want to have this info in one column instead of two
Can anyone help?
 
Back
Top