Control Source calculation error

  • Follow


Hi there,

Just a bit confused at the moment & would love some help . 

All other fields in this table are ok except this one. 

I'm no access genius, I was reluctant to pay $15000 for a weighbridge 
program so I made one myself.

The control source is as follows for the Trailer 1 Nett field,
=[Trailer 1 Gross]-[Trailer 1 Tare]
The numbers(& result) are,
41.08-34.28 = 6.800003 (should display as just 6.8)

It just seems to be ignoring all the decimal formats (set to 2) we have 
place which are working perfectly everywhere else except for this 1 record.

Thanks in advance.
0
Reply Utf 12/5/2007 5:07:00 AM

On Tue, 4 Dec 2007 21:07:00 -0800, Joshua J wrote:

> Hi there,
> 
> Just a bit confused at the moment & would love some help . 
> 
> All other fields in this table are ok except this one. 
> 
> I'm no access genius, I was reluctant to pay $15000 for a weighbridge 
> program so I made one myself.
> 
> The control source is as follows for the Trailer 1 Nett field,
> =[Trailer 1 Gross]-[Trailer 1 Tare]
> The numbers(& result) are,
> 41.08-34.28 = 6.800003 (should display as just 6.8)
> 
> It just seems to be ignoring all the decimal formats (set to 2) we have 
> place which are working perfectly everywhere else except for this 1 record.
> 
> Thanks in advance.

 =Format([Trailer 1 Gross]-[Trailer 1 Tare],"#.00")
 
 Will return 2 decimals.

-- 
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
0
Reply fredg 12/5/2007 6:07:05 AM

On Tue, 4 Dec 2007 21:07:00 -0800, Joshua J
<JoshuaJ@discussions.microsoft.com> wrote:

>Hi there,
>
>Just a bit confused at the moment & would love some help . 
>
>All other fields in this table are ok except this one. 
>
>I'm no access genius, I was reluctant to pay $15000 for a weighbridge 
>program so I made one myself.
>
>The control source is as follows for the Trailer 1 Nett field,
>=[Trailer 1 Gross]-[Trailer 1 Tare]
>The numbers(& result) are,
>41.08-34.28 = 6.800003 (should display as just 6.8)
>
>It just seems to be ignoring all the decimal formats (set to 2) we have 
>place which are working perfectly everywhere else except for this 1 record.
>
>Thanks in advance.

It appears that you're using a Single Float size number. Floating point
numbers, by their nature, are approximations - a single float is accurate to
about 7 decimal places. Just as the fraction 1/7 cannot be represented exactly
as a decimal number, so the fraction 1/100 (or 1/10) cannot be represented
exactly as a binary fraction - and therefore not as a floating point number.

I'd suggest not using a Number datatype for this field at all; instead, use a
Currency datatype. A Currency field is a huge scaled integer which stores
exactly four decimal places, no more, no fewer; you can hide some of those
four digits by setting the Format or decimal places properties, but they're
still there.

Or, you can use

=Round([Trailer 1 Gross]-[Trailer 1 Tare], 2)

to round the result to two decimal places. I'd really suggest a Currency
datatype though.

             John W. Vinson [MVP]
0
Reply John 12/5/2007 6:53:54 AM

On Tue, 4 Dec 2007 22:07:05 -0800, fredg <fgutkind@example.invalid> wrote:

>On Tue, 4 Dec 2007 21:07:00 -0800, Joshua J wrote:
>
>> Hi there,
>> 
>> Just a bit confused at the moment & would love some help . 
>> 
>> All other fields in this table are ok except this one. 
>> 
>> I'm no access genius, I was reluctant to pay $15000 for a weighbridge 
>> program so I made one myself.
>> 
>> The control source is as follows for the Trailer 1 Nett field,
>> =[Trailer 1 Gross]-[Trailer 1 Tare]
>> The numbers(& result) are,
>> 41.08-34.28 = 6.800003 (should display as just 6.8)
>> 
>> It just seems to be ignoring all the decimal formats (set to 2) we have 
>> place which are working perfectly everywhere else except for this 1 record.
>> 
>> Thanks in advance.
>
> =Format([Trailer 1 Gross]-[Trailer 1 Tare],"#.00")
> 
> Will return 2 decimals.

.... as a text string, not as a number, however. Good idea for display, but may
cause trouble for further calculations!

             John W. Vinson [MVP]
0
Reply John 12/5/2007 6:54:41 AM

Thanks Guys. Good result. Happy Xmas

"John W. Vinson" wrote:

> On Tue, 4 Dec 2007 21:07:00 -0800, Joshua J
> <JoshuaJ@discussions.microsoft.com> wrote:
> 
> >Hi there,
> >
> >Just a bit confused at the moment & would love some help . 
> >
> >All other fields in this table are ok except this one. 
> >
> >I'm no access genius, I was reluctant to pay $15000 for a weighbridge 
> >program so I made one myself.
> >
> >The control source is as follows for the Trailer 1 Nett field,
> >=[Trailer 1 Gross]-[Trailer 1 Tare]
> >The numbers(& result) are,
> >41.08-34.28 = 6.800003 (should display as just 6.8)
> >
> >It just seems to be ignoring all the decimal formats (set to 2) we have 
> >place which are working perfectly everywhere else except for this 1 record.
> >
> >Thanks in advance.
> 
> It appears that you're using a Single Float size number. Floating point
> numbers, by their nature, are approximations - a single float is accurate to
> about 7 decimal places. Just as the fraction 1/7 cannot be represented exactly
> as a decimal number, so the fraction 1/100 (or 1/10) cannot be represented
> exactly as a binary fraction - and therefore not as a floating point number.
> 
> I'd suggest not using a Number datatype for this field at all; instead, use a
> Currency datatype. A Currency field is a huge scaled integer which stores
> exactly four decimal places, no more, no fewer; you can hide some of those
> four digits by setting the Format or decimal places properties, but they're
> still there.
> 
> Or, you can use
> 
> =Round([Trailer 1 Gross]-[Trailer 1 Tare], 2)
> 
> to round the result to two decimal places. I'd really suggest a Currency
> datatype though.
> 
>              John W. Vinson [MVP]
> 
0
Reply Utf 12/11/2007 10:49:00 PM

4 Replies
319 Views

(page loaded in 0.122 seconds)

Similiar Articles:
















7/16/2012 8:18:35 PM


Reply: