Calculation/ decimal problem

G

Guest

Hi- Hope you can help!


I am running a macro (Run SQL) as follows:

UPDATE tvc Set field2 = ((ScannedUnits)/BaseUnits)*100 WHERE 1=1

The problem with this statement or field is that it rounds up/down the
calculation.

If the answer is: 118.446, in the field it rounds it down to: 118.00

I have tried setting the decimal point to two or more, but it just gives me
zeros. I want the return result to be the exact calculation of: 118.446.



Hopefully I explained this OK.

Thanks if you can be of any help!
 
D

Douglas J. Steele

What's the data type of field2? When you set a field to Number, the default
Field Size (lower left-hand corner) is Long Integer, which cannot hold any
decimal points. You need to change the Field Size to a type that can hold
decimals: Single, Double or Decimal.
 
G

Guest

Thanks for responding Doug...I have a follow-up question though.

Yes, my field type is Text.

In Field Size it was defaulted to 50. Are you suggesting I change it to
"Decimal?" Or my question is, what do I enter into that field other than
"50?" It appears it only allows me to enter in numbers??
 
J

Jamie Collins

What's the data type of field2? When you set a field to Number, the default
Field Size (lower left-hand corner) is Long Integer, which cannot hold any decimal points.

In Access 2007, the default is DECIMAL ;-)

Jamie.

--
 

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

Top