Accuracy of calculated fields in queries

swift

Registered User.
Local time
Today, 15:47
Joined
Mar 12, 2006
Messages
67
Hello again,

This time I'm having an issue with a calculated field I've got in a query. My form (which is based on the query) has two fields [NumberPostsTested] and [NumberPostsFailed]. The query is calculating [NumberPostsFailed] / [NumberPostsTested] * 100 (basically its giving a percentage of failures).

The issue is that Access 2007 is going to the Nth degree to calculate the answer. For example, 100 posts tested and 8 posts failed, I work that out as 8% failure rate. Access, however, thinks differently and returns 7.99999982118607%. Whilst I can change the levels of accuracy so that it displays 8%, in subsequent calculations of this number its giving me problems.

In a nutshell I would like Access to roundup or down any percentage to the nearest whole number, in order to use it in subsequent functions/calculations.

I hope I've explained that well enough for somebody to help.

Thanks in advance.

Swifty;)
 
You can wrap the calculation in the Round() function. Either your fields are Double, or Access is using it for the calculation. Double and Single are floating point types, and will result in that type of thing.
 
PBaldy, thanks for that - I suppose thats really something I should know, seems kinda simple.

Cheers anyway, save me some time there!:D
 

Users who are viewing this thread

Back
Top Bottom