Calculating costs and minimum charges

  • Thread starter Thread starter neil taylor
  • Start date Start date
N

neil taylor

Guest
I am setting up a database where I would like to calculate a price by multiplying together values from two fields, compare the price with a minimum charge held in another field and have only the higher value displayed.

Can anyone help?
 
Hi Neil

I am sure there is more than one way to do this ... but my suggestion is through a query.

In this query you will obviously need the three fields concerned - Price, Quantity and your MinimumValue.

Create a new column in the query called SubTotal, and create an expression/calculated field based on the two known values multiplied together, along these lines ...

SubTotal:[Price]*[Quantity]

You now need to compare this with your MinimumValue and to display whichever is the greater, so you can use IIf - Immediate If.

Create another expression in a new column in the query design with the name Display and use the following expression.

Display:IIf([Subtotal]>=[MininmumValue],[Subtotal],[MinimumValue])

This should give you the higher of the two values. In your form or datasheet you would only show the fields/columns Quantity, Price, Display (and as you have created this through a query you can use it behind reports, forms and so on).

HTH

Rich Gorvin

[This message has been edited by Rich@ITTC (edited 09-17-2001).]
 

Users who are viewing this thread

Back
Top Bottom