calculate in form

  • Thread starter Thread starter cram
  • Start date Start date
C

cram

work with Xp and Access2003
I want to do following
In an Input form I want to check if some data aore correct. based on
invoices I introduce the BasicAmount, the txes and the total of the invoice
i.e. the sum of Basic + Taxes say i.e. 100 + 21 = 121
I intorduce the 100, the 21 and the 121. As matter of contol I compare the
calculated sum of 100+21 and compare with the inputed 121. If there is a
difference I show an error message.
My problem is now that for SOME records the message appears although the 3
inputs are correct.
As futher detail, all nummers are "single".
I'm afraid that in calculating "the sum" there must be some "distorsion"
somewhere in the decimal-figures.
Any one any idea?
 
You need to show us what your formulas look like.

Also post examples of the 'distortion' you are getting, input and output
numbers.
 
work with Xp and Access2003
I want to do following
In an Input form I want to check if some data aore correct. based on
invoices I introduce the BasicAmount, the txes and the total of the invoice
i.e. the sum of Basic + Taxes say i.e. 100 + 21 = 121
I intorduce the 100, the 21 and the 121. As matter of contol I compare the
calculated sum of 100+21 and compare with the inputed 121. If there is a
difference I show an error message.
My problem is now that for SOME records the message appears although the 3
inputs are correct.
As futher detail, all nummers are "single".
I'm afraid that in calculating "the sum" there must be some "distorsion"
somewhere in the decimal-figures.
Any one any idea?

Since these values refer to money, I'd strongly suggest using the Currency
datatype rather than Number... Single. Single numbers are floating point
values; as such, some values cannot be represented accurately. 100 and 21
should work, but (for instance)

?csng(3.1) + csng(5.3) - 8.4
9.53674312853536E-08

Single *IS AN APPROXIMATION*, accurate to about 7 decimal places, and as you
see, not always exact!

Using Currency datatype avoids this issue:

?ccur(3.1) + ccur(5.3) - 8.4
0
 
Back
Top