[AccessD] Strange results with simple calculation on a form

Bert-Jan Brinkhuis thevigil at kabelfoon.nl
Thu Mar 18 02:19:54 CST 2004


Charlotte,

they are just values users type and they are only added to a total.
I'll try the currency format.

thanks,

Bert-Jan

----- Original Message ----- 
From: "Charlotte Foust" <cfoust at infostatsystems.com>
To: "Access Developers discussion and problem solving"
<accessd at databaseadvisors.com>
Sent: Thursday, March 18, 2004 1:38 AM
Subject: RE: [AccessD] Strange results with simple calculation on a form


> Are you trying to do any kind of calculations with these numbers, even
> simple addition or subtraction, and then comparing the results?  If
> there are any doubles or singles involved, you can certainly get this
> kind of weird result courtesy of floating point number creep.  If you
> change any double or single formats to currency, that should take care
> of it.  Currency doesn't have to use a $, and since it isn't floating
> point, the problem should disappear.
>
> Charlotte Foust
>
> -----Original Message-----
> From: Bert-Jan Brinkhuis [mailto:thevigil at kabelfoon.nl]
> Sent: Wednesday, March 17, 2004 3:02 PM
> To: accessd at databaseadvisors.com
> Subject: [AccessD] Strange results with simple calculation on a form
>
>
> Hi all,
>
> i was forced to unsubscribe a while ago because i couldn't keep up with
> you and all the messages... ;-)
>
> But today a strange thing happened i had to ask you all about. I didn't
> do a big search on the internet, but searched the accessd archives and
> didn't find it. It maybe is a well known problem, but here it goes.....
>
> I have an unbound form where users will type amounts. All the txtboxes'
> format are set to "standard" and the decimal places is set to 2. And i
> check on the before_update event of these txtboxes if there are more
> then 2 decimals, if so, cancel = true. There is an calculated total
> control
> (txtTotal) wich has a controlsource like =[txtbox1]+[txtbox2] and so on
> (in total 12 txtboxes) These txtboxes are used to 'split up' the amount
> in another txtbox.
> (txtAmount)
>
> Before saving i check if txtAmount = txtTotal. When no decimals are used
> there is no problem, if there are only used decimals in 1 txtbox there
> is no problem. But if there are used decimals in more txtboxes access
> will tell me the values are not the same..... although the same values
> are shown... it turns out there is a difference of:
> 0.00000000000000710542735!!!!!! (debug.print told me this!)
>
> When i use the same 'function' in VBA it works fine with the same
> values....????
>
> So it is not a real problem, but it IS something strange... wel to me it
> is....
>
> Thanks in advance.
>
> Hope to keep up with you this time... ;-)
>
> Bert-Jan
>
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> -- 
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com




More information about the AccessD mailing list