Round-Up?

scouser

Registered User.
Local time
Today, 19:03
Joined
Nov 25, 2003
Messages
767
Guys, I have a slight (only slight) problem with my order / order payments form.

If the Order Total = £15 then you add vat (£2.625)
The VAT rounds up to £2.63 and the order Total = £17.63 (when you click the field it displays £17.625).

Problem: The payment form displays an outstanding balance of £17.63. When the user enters this amount they get an error as they are attempting to pay more than the Total Outstanding (£17.625)!!

Quick solution maybe? All variables in VBA calculation are now set as double, decimal places = Auto.
thanks in advance,
Phil.
 
Hi

This is a real pain because although you can set the number of decimal places in a currency value to 2 for display, it always stores 4 places, and I havn't found a way to force it to round to 2 places.

The method I use is to multiply the answer by 100, take the integer value and divide by 100, thus removing the last 2 places.
to make sure that values of 0.5 to 0.99 are rounded up, add 0.5 to the total before multiplying by 100.
ie

(int((Total + 0.5)*100))/100

you can put this expression into the record source of the control that contains the total on your form.

I have used this many times and found that it works ok.

Hope this helps

Sue
 
suepowell said:
I haven't found a way to force it to round to 2 places.

=CCurr(Format(value, "0.00"))
 
Thanks

thank you Sue & Mile-o. Mile-O, where should I stick your code (resist the temptation.......resist!!).
Phil.
 
Forgot to mention....

Form Based on a query. Tried your code mile-o in the criteria for the Total field....Why.....because I don't know what I'm doing that's why I'm still up at 11!!! (Again!) Ha! Ha!
 
Sorted

Mr Cat has shown me the way!! Cheers for your help guys & girls!
Phil.
:)
 

Users who are viewing this thread

Back
Top Bottom