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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Woes with Rounding numbers in a calc fields

Status
Not open for further replies.

jimfrmla

Programmer
Nov 11, 2004
16
US
I am adding some values from other fields into a calc field. The values keep getting rounded up to the next whole number and I need to turn off the rounding so that this does not happen. I tried specifying the fields as decimal and currency in the table and on the form. It still rounds the numbers up. Below is and example of what I want it to do or what it should be doing and then another example of the actual results.

=[cboxNo1]*[CcubeNo1]+[cboxNo1a]*[CcubeNo1a]

10 x 1.5 + 5 x 3.5 should equal = 32.5

This expression is in field [Ccubecalc1]

Because the numbers are being rounded up, I get a total of 40 as a result in the Ccubecalc1 field. There has got to be a way to stop the data fields or calc fields from rounding numbers
 
And this ?
=CDec(CDec([cboxNo1])*CDec([CcubeNo1])+CDec([cboxNo1a])*CDec([CcubeNo1a]))


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
To PHV, thanks for the code but unfortunately it didn't work at all. The numbers still keep rounding up to the next whole interger. There must be a setting somewhere to turn off the rounding.

Thanks Again
 
And this ?
=(100*[cboxNo1]*[CcubeNo1]+100*[cboxNo1a]*[CcubeNo1a])/100


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
How are ya jimfrmla . . . . .

I see what appears to be two [blue]comboboxes![/blue]

Try changing the [purple]Bound Column[/purple] property of the comboboxes to [purple]2[/purple], or those [blue]column numbers[/blue] that hold the data!

[blue]Its not possible for a Math CoProcessor to be that inaccurate![/blue]

Calvin.gif
See Ya! . . . . . .
 
Yea, and make sure you have defined your data types correctly. When you define the data type for a field as numeric, Access will default to Long Interger. Since you want to track decimal places, consider data type Single precision or Decimal.

You can change the data type by...
- backup / copy your table or database
- opening the table in design mode
- select the specific field that is defined as numeric
- now select the "Field size" field in the "Field Properties" section.
- from the list box, choose the appropriate data type

Note: Changing a data type of field that is use can result in several events. It may fail because of incompatability -- or -- because of insufficient working space for the databse. It may proceed smoothly without incident. It may change numbers with unexpected results. And the process may take some time.

Once you have converted the data type, your appraent integer problem will most likely go-away. But then you may have to contend with decimal places and significant digits. You can control most of this through the use of the control object on the form, such as setting the number of significant digits / the decimal part of the number.

Richard
 
I figured out what the problem was with the rounding. In fact had I just left the field as a text field it would have worked just fine. Thanks everyone for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top