Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding problem 1

Status
Not open for further replies.

philcon

Technical User
Feb 5, 2002
139
GB
Hi all,

Tried to look this up in keyword search but kept timing out so here I am.

Using Access 2002/winxp (though I know this has nothing to do with my problem)

I have created some calculated expressions in a query for use in a report.

eg

Palls :(tbl_NoTransItems!Logical_units_in_stock/[Logical_Units_per_Billing_Measure])/tbl_Billing_Measures!pallets

charge: [palls]*tbl_Rates![Daily Rate]*tbl_NoTransItems!days


These fields are used in a report output format.

My problem is this, despite setting the format properties of the calculated field Palls to fixed 3, the field charge is treating it as a general number utilising all decimal places available.

Thus on the report it essentially says

0.833 x 2.00 x 30 = 50.00

when in fact if my boss takes out his calculator it will tell him that

0.833 x 2.00 x 30 = 49.98

Can anyone help me round this (pardon the pun)

Thanks in advance


Philcon
 
Try defining
Code:
charge
as:
Code:
charge: Format([palls]*tbl_Rates![Daily Rate]*tbl_NoTransItems!days, "0.000")
This may slow your query down slightly but should give you what you need.

[pc2]
 
Thanks MP9,

The answer you put forward would make

0.833 x 2.00 x 30 = 50.000

However, got the gist of what you meant and changed palls to :

palls :Format(([tbl_NoTransItems]![Logical_units_in_stock]/[Logical_Units_per_Billing_Measure])/[tbl_Billing_Measures]![pallets],"0.000")

which did in fact have the desire result.

Many thanks and a star to you sir.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top