disable rounding up & down in access 2007?

D

dtpww

How would I disable rounding up & down in access 2007?
e.g. If I multiply 50 * 6.75 = 337.50 but it is rounded up to 338.
I want the exact value to be displayed.

Send replies to (e-mail address removed)

Thanks.
 
M

Marshall Barton

dtpww said:
How would I disable rounding up & down in access 2007?
e.g. If I multiply 50 * 6.75 = 337.50 but it is rounded up to 338.
I want the exact value to be displayed.


Maybe the text box has its Decimal Places property set to
1??

For specific formatting, set the text box's Format property
to a format that includes the number of places you want to
see. If there are more places in the value than in the
format, they will be rounded.

If you want to see 5 places if they are there, but always
see 2, then the format could be:
0.00###
See VBA Help - Format property for details.
 
J

John Spencer

IS this data being assigned to a field?

Is it a number field?

Is the field type Integer or Double (integer)? If so, integer field can only
contain whole numbers - no decimal portion. Access will round the result to
an integer value. Change the Field Size property to DOUBLE or change the
field type to Currency (if 4 decimal places are sufficiently accurate).

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
D

dtpww

In my table, I have 3 fields.
Hours, hourly_rate & total_chges.
The total_chges is the product of the Hours * hourly_rate.
I've tried setting each to Curr, Double & Single in my table.
The data for these fields are entered on a form & the calc is performed on
the form & assigned to the respective fields in the tbl.
I've set the Format for these flds on the frm to Curr, Std & Number with the
same rounding up results
 
J

John W. Vinson

In my table, I have 3 fields.
Hours, hourly_rate & total_chges.
The total_chges is the product of the Hours * hourly_rate.

In that case IT SHOULD NOT EXIST.

Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact.

Just redo the calculation whenever you need it, either as a
calculated field in a Query or in the control source of a Form or a Report
textbox.
I've tried setting each to Curr, Double & Single in my table.

Hourly_rate should be Currency, I would assume; Hours could either be a
Number... Single, or (perhaps better) Number... Long Integer storing minutes
rather than hours. If you're entering the starting time and the end time of
the work session in Date/Time fields you could use DateDiff() to dynamically
calculate the amoutn of time worked.
The data for these fields are entered on a form & the calc is performed on
the form & assigned to the respective fields in the tbl.
I've set the Format for these flds on the frm to Curr, Std & Number with the
same rounding up results

The Format merely controls how the value in the field is displayed. It does
not affect the storage of the data; that's controlled by the field's data type
(Number, Currency, Date/Time, etc.)
 
J

John Spencer

First, you should not be storing total_chges at all. You can always calculate
that value by using the expression Hours * Hourly_rate when you need it. It
is almost always a good idea to do the calculation and not store the result.

Hourly_rate should be a currency field.
Hours should be a number field of type Double or a currency field.

IF you insist on storing the total_chges then that field should also be currency.

If you are getting rounding with this setup check how many decimal places you
have set on the controls (on the format tab) and on the field. If it is set
to zero then you are going to see rounding (actual value stored may be different).

John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Joined
Oct 21, 2010
Messages
1
Reaction score
0
round off even on data entry

Sometimes people don't know and still tried to answer (I wonder...), they should test it out first in their access first.

I had the same problem, and I tried to find the answer from online and no good and finally I figured it out and I thought of sharing the resolution so that people will know regardless how late this reply is.

The solution is simple

Design view of your table.

Go to your field (number) and format and put in Decimal and change Scale to 0 (decimal you can put 2 or 3 depending on your entry), but most important thing is scale!!
 
Joined
Mar 22, 2011
Messages
1
Reaction score
0
Set that hourly rate to text. then in code use the VB or VBA Clng(Variable) to convert to long integert for math. This is what I am doing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top