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

Decimal Places Limiting - rusty

Status
Not open for further replies.

Chance1234

IS-IT--Management
Jul 25, 2001
7,871
US
right i have a field that i need the data to be only 2 decimal places and the entry of data to that field has to be only 2 decimal places.

if i set the field up as

>Single
>Fixed
>2

I will get the field displaying 2 decimal places but it is possible to enter data with more than 2 decimal places (the machine will round ) and Access will use those extra decimal places in calculations - correct ?

If i set the field up as decimal
>Decimal
scale>2
decimal>2

This will ensure that the data can only be two decimal places.

the second method though requires more storage and calculations are slower - correct ?

or is there a better way that those lunch time pub sessions have washed away from my mind.

Filmmaker, gentleman and i have a new site half working
 
Hi Chance.
Decimal fields take 12 bytes of storage opposed to 4 bytes for Single datatype. So it does require more storage.
But: scale 2 will limit valid entries to 1 chiffre before and 1 behind the decimal point, i.e. 2 in total

So you need to adapt your scale property to the maximum allowed entry. Thus for numbers up to 999.99, you need scale 5. :-/

As I don't know of any "precision" property for other data types, you will have to use Decimal datatype, I'm afraid.

Does anyone know better?

Cheers,
Andy

[blue]The last voice we will hear before the world explodes will be that of an expert saying:
"This is technically impossible!" - Sir Peter Ustinov[/blue]
andreas.galambos@bowneglobal.de
HP:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top