Discussion Locked

Access 97/2000 Presision for Currency

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a form, with two subforms on it.

The on subform has the detailed data, the other adds up one column from the detail. If the sum is not zero an error will pop up.

The detailed data is currency.

The data is saved as a Double with Two decimal spaces. For some reason it does not like the number 139,211.48
When I type this number in the subform does not add up to zero, even though it should

ant ideas?

3 replies

by bob sellman

How are you adding the data? I don't know why that number might be a problem, but for your addition I would suggest that as part of the addition process you round each number in your code BEFORE adding it. In fact, for real accuracy, in your code multiply each number by 100, make it a long integer, add together, and do your comparison (with the sum handled the same way in your code).

I suggest this, especially using long integers for your "behind the scenes" calculations because double precision still carries "junk" along with what you entered (because binary cannot accurately represent some decimal numbers). Going to long integers within your calculations lets you eliminate this problem.

Unfortunately, Access does not, to my knowledge, offer what used to be called "decminal coded binary" numbers, which is a way of accurately representing decimal numbers with binary code.

This discussion is closed to new replies.