ROUNDING PROBLEM IN ACCESS 2002

L

Larry J.

I'm having trouble with Rounding in Access 2002...

Here's my formula:
Extended Cost:([Mileage]*0.345)+[Cost]

When I run that formula through my query, with Cost = $25 and Mileage = 25,
my Extended Cost displays as $33.63, which is correct. However, when I click
on that, the screen removes the $ and displays 33.625 ---

So, I modify the formula to include rounding:
Extended Cost:Round(([Mileage]*0.345)+[Cost],2)

Now, my Extended Cost displays as $33.62, which is NOT correct! When I
click on that figure, the screen removes the $, but RE-displays 33.62 ---

HOW do I get this ROUNDING formula to work? I want the net result to
display AND store 33.63 ---

Any help from anyone out there would be greatly appreciated.
 
G

Gerald Stanley

Try
Extended Cost:Round(([Mileage]*0.345)+[Cost]+0.0001,2)
This should overcome 33.625 being rounded to 33.62

Hope This Helps
Gerald Stanley MCSD
 
L

Larry J.

Thanks, Gerald... nothing warned me about Banker's Rounding .625 --> .62

FYI... I tried 0.001 for the bias and it worked!

Larry

Gerald Stanley said:
Try
Extended Cost:Round(([Mileage]*0.345)+[Cost]+0.0001,2)
This should overcome 33.625 being rounded to 33.62

Hope This Helps
Gerald Stanley MCSD

Larry J. said:
I'm having trouble with Rounding in Access 2002...

Here's my formula:
Extended Cost:([Mileage]*0.345)+[Cost]

When I run that formula through my query, with Cost = $25 and Mileage = 25,
my Extended Cost displays as $33.63, which is correct. However, when I click
on that, the screen removes the $ and displays 33.625 ---

So, I modify the formula to include rounding:
Extended Cost:Round(([Mileage]*0.345)+[Cost],2)

Now, my Extended Cost displays as $33.62, which is NOT correct! When I
click on that figure, the screen removes the $, but RE-displays 33.62 ---

HOW do I get this ROUNDING formula to work? I want the net result to
display AND store 33.63 ---

Any help from anyone out there would be greatly appreciated.
 
T

tamxwell

Larry,
Question, will the 0.001 bias work for rounding out whole numbers?. I have a
complex query (UNION ALL) one of my fields is [Today]-[due-date] AS DSO. No
one is sure why it's not DOD (days over due)? but it's DSO. This subtracts
the field [Today] or todays date, from the field [due-date] original due
date. So if it was due 3 days ago then in the DSO column it would show 3 days
, but it's more like 3.335846554654.

Thanks Todd


Larry J. said:
Thanks, Gerald... nothing warned me about Banker's Rounding .625 --> .62

FYI... I tried 0.001 for the bias and it worked!

Larry

Gerald Stanley said:
Try
Extended Cost:Round(([Mileage]*0.345)+[Cost]+0.0001,2)
This should overcome 33.625 being rounded to 33.62

Hope This Helps
Gerald Stanley MCSD

Larry J. said:
I'm having trouble with Rounding in Access 2002...

Here's my formula:
Extended Cost:([Mileage]*0.345)+[Cost]

When I run that formula through my query, with Cost = $25 and Mileage = 25,
my Extended Cost displays as $33.63, which is correct. However, when I click
on that, the screen removes the $ and displays 33.625 ---

So, I modify the formula to include rounding:
Extended Cost:Round(([Mileage]*0.345)+[Cost],2)

Now, my Extended Cost displays as $33.62, which is NOT correct! When I
click on that figure, the screen removes the $, but RE-displays 33.62 ---

HOW do I get this ROUNDING formula to work? I want the net result to
display AND store 33.63 ---

Any help from anyone out there would be greatly appreciated.
 
J

John Spencer (MVP)

Well, if you are subtracting dates and not getting whole numbers then the dates
also have a time component in them.

Try using the DateDiff function?

DateDiff("d",[Due-Date],[Today])

another option is to force the field(s) to contain only the date component. You
can use the DateValue function to do this or you can use CLng to do this or the
Int function.


Larry,
Question, will the 0.001 bias work for rounding out whole numbers?. I have a
complex query (UNION ALL) one of my fields is [Today]-[due-date] AS DSO. No
one is sure why it's not DOD (days over due)? but it's DSO. This subtracts
the field [Today] or todays date, from the field [due-date] original due
date. So if it was due 3 days ago then in the DSO column it would show 3 days
, but it's more like 3.335846554654.

Thanks Todd

Larry J. said:
Thanks, Gerald... nothing warned me about Banker's Rounding .625 --> .62

FYI... I tried 0.001 for the bias and it worked!

Larry

Gerald Stanley said:
Try
Extended Cost:Round(([Mileage]*0.345)+[Cost]+0.0001,2)
This should overcome 33.625 being rounded to 33.62

Hope This Helps
Gerald Stanley MCSD

:

I'm having trouble with Rounding in Access 2002...

Here's my formula:
Extended Cost:([Mileage]*0.345)+[Cost]

When I run that formula through my query, with Cost = $25 and Mileage = 25,
my Extended Cost displays as $33.63, which is correct. However, when I click
on that, the screen removes the $ and displays 33.625 ---

So, I modify the formula to include rounding:
Extended Cost:Round(([Mileage]*0.345)+[Cost],2)

Now, my Extended Cost displays as $33.62, which is NOT correct! When I
click on that figure, the screen removes the $, but RE-displays 33.62 ---

HOW do I get this ROUNDING formula to work? I want the net result to
display AND store 33.63 ---

Any help from anyone out there would be greatly appreciated.
 
Top