H
Henry Smith
Therefore, I have to calculate an item's selling price to the nearest 5
cents. Unfortunately, the sale price I am trying to create is based on a
source that uses pennies. My attempts to calculate a sale price to the
nearest 5 cents has failed. The factors I am working with are Purchase
price, surcharge, monetary conversion factor and profit margin. I have been
able to achieve a sales price to the nearest 10 cents with the following
procedure and the Round function (see code). The input variables are
derived from text boxes on a form. For simplicity in this example code I
have set the variables to a specific value Using Access 2000 Professional.
Any ideas on how to achieve a sales price to the nearest 5 cents will be
greatly appreciated.
Cheers,
Henry
Sub CalculateSalesPrice ()
Dim PurchasePrice As Single
Dim Var1 As Single 'Comment Var1 = surcharge
Dim Var2 As Single 'Comment Var2 = monetary conversion factor
Dim Var3 As Single 'Comment Var3 = profit margin
Dim Cost As Single 'Comment Value before adding profit margin
Dim PreSalesPrice 'Comment Value before rounding
Dim SalesPrice As Single 'Comment this is the sales price
PurchasePrice = 1.27
Var1 = 1.05
Var2 = 1.35
Var3 = 1.27
Cost = PurchasePrice * Var1* Var2
PreSalesPrice = Cost * Var3
SalesPrice = Round(PreSalesPrice,1)
'Comment Sales price for this example equals 1.40
End Sub
cents. Unfortunately, the sale price I am trying to create is based on a
source that uses pennies. My attempts to calculate a sale price to the
nearest 5 cents has failed. The factors I am working with are Purchase
price, surcharge, monetary conversion factor and profit margin. I have been
able to achieve a sales price to the nearest 10 cents with the following
procedure and the Round function (see code). The input variables are
derived from text boxes on a form. For simplicity in this example code I
have set the variables to a specific value Using Access 2000 Professional.
Any ideas on how to achieve a sales price to the nearest 5 cents will be
greatly appreciated.
Cheers,
Henry
Sub CalculateSalesPrice ()
Dim PurchasePrice As Single
Dim Var1 As Single 'Comment Var1 = surcharge
Dim Var2 As Single 'Comment Var2 = monetary conversion factor
Dim Var3 As Single 'Comment Var3 = profit margin
Dim Cost As Single 'Comment Value before adding profit margin
Dim PreSalesPrice 'Comment Value before rounding
Dim SalesPrice As Single 'Comment this is the sales price
PurchasePrice = 1.27
Var1 = 1.05
Var2 = 1.35
Var3 = 1.27
Cost = PurchasePrice * Var1* Var2
PreSalesPrice = Cost * Var3
SalesPrice = Round(PreSalesPrice,1)
'Comment Sales price for this example equals 1.40
End Sub