View Single Post
  #2  
Old May 30th, 2010, 10:27 PM posted to microsoft.public.access.forms
Lord Kelvan
external usenet poster
 
Posts: 637
Default Help with an expression to calculate a profit from one of threefi

mmm well my guess would be

[cost on hand]=iif(Nz([PieceCost])*Nz([PiecesOnHand])0,
Nz([PieceCost])*Nz([PiecesOnHand]),iif(Nz([PieceCost])*Nz([PiecesOnHand])0,
Nz([PieceCost])*Nz([PiecesOnHand]),Nz([UnitCost],0)*Nz([UnitsOnHand],
0)))

This checks if the cost of pieces is 0 if not then it says the cost on
hand is the cost of pieces if it is 0 then it checks the subunits if
the sub units cost is not 0 it will use the subunits cost as cost on
hand and if that is 0 it will use the units as cost on hand.

Though this code won’t work if you have pieces lets say and they have
no cost to the company then I would use this code

[cost on hand]=iif(Nz([Pieces on hand])0,
Nz([PieceCost])*Nz([PiecesOnHand]),iif(Nz([Subunits on hand])0,
Nz([PieceCost])*Nz([PiecesOnHand]),Nz([UnitCost],0)*Nz([UnitsOnHand],
0)))

This will do the same but will check to see if the pieces on hand
value is 0 and so on rather than the cost value

Hope this helps

Regards
Kelvan