View Full Version : My computer can't subtract?


trgreen
03-13-2001, 01:05 AM
I have a cash register application. Actual tendered minus Total Charges occasionally returns an incorrect value (off by a penny).

Actual tendered is the sum of values in a split payments subform.

Total Charges is based on the sum of subtotal in a purchases form. The value is placed in the split payments subform footer using dlookup.

Atomic Shrimp
03-13-2001, 02:22 AM
I suspect that the values that you're summing aren't whole (in terms of pennies) they may have decimal portions after the second place.

i.e. 1.504 may show as £1.50 because of your format properties, but it's still stored as 1.504 behind the scenes, so 1.504 * 10 = 15.04 (you gain four pence from seemingly nowhere)

You might find it preferrable to round the values beofre storing them; have a search on 'Rounding' in all forums.

Alternatively (so I'm told) defining the field type as 'Currency' (rather than 'number') in your table forces Access to treat them values properly, but I've never tested this.


HTH

Mike