Why is 300.00 greater than 300

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 controls both have property 'General number' and decimal places
'Auto'. One contains 300 and the other 300.00. When I do a 'greater than'
check in conditional formatting, it flags 300.00 as greater than 300. Why is
this and how to fix it ???
 
Because of the way Access (and computers in general) store number
300.00 will be higher than 300 - basically because even if 300.0
carried on to something lik
300.0000000000000000000000000000000000000000000000000000001 it stil
has a 1 at the end which makes it a tiny bit higher than 300

The easiest way to solve this is by giving a small bit of flexibility
assuming A = 300 and B = 300.00; instead of doing

A >

Do something like

A+0.001 >

By increasing the value you're checking against slightly you take int
account any minor discrepancies but because you're increasing it b
.001 (only an increase of 1 in the third decimal place) it'll stil
find show that 300.01 is greater than 300

If it's not accurate enough just slap on a few more 0's until you'r
happy
 
mscertified said:
I have 2 controls both have property 'General number' and decimal places
'Auto'. One contains 300 and the other 300.00. When I do a 'greater than'
check in conditional formatting, it flags 300.00 as greater than 300. Why is
this and how to fix it ???


If the "numbers" are stored in Text fields in their table,
they will be sorted in alphabetical order.

There are also times when a query will convert an numeric
table field to Text, especially if the query field is
calculated.

You can check for this situation by using the appropriate
conversion function in your comparison, e.g. CDbl(f1) >
CDbl(f2)
 
Back
Top