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

Limit data entry to 2 decimals - no more...

Status
Not open for further replies.

cariengon

Technical User
Mar 18, 2002
283
0
0
US
Does anyone know how to limit the data entry into a field so that it will not accept more than 2 numbers after the decimal point? I have folks doing a huge data entry project and due to human error, sometimes an additional digit is entered after the .00. I've looked at the Validation Rules, but cannot find any rule that will allow me to do this.

Any ideas?

Thanks,
Carie
 
Use the format property on the format tab - change the control to whatever type of number you need from the dropdown list (fixed - standard, etc.) and then right underneath, you can state how many decimal places you want.
HTH

Carol
 
You can, in the after-update event, manipulate the number that was entered like this:

[Field] = Int(100 * [Field]) / 100

This would truncate off any digits past two. Beware, due to the innacuraccy of floating point numbers, the field may still be past two decimal points, something like 4.500015 instead of 4.50, or sometimes it might be like 4.499985. It's darn close, but never perfect.
 
The format tab, as I understand, only manipulates how the number is displayed, not how the number is recorded...
 
After consulting my "Using Access 2000" book, I found that you can limit the entry of decimals by using the decimal format(not double or integer)and input the number of decimals you want after the decimal point in 'Scale' (which appears in the General tab after you select the Decimal format). This is a new feature in 2000 and there wasn't any real solid information available in MS Knowledge base abuot this.

I decided to not make this change as it could impact the data that has already been entered. But I would definitely use this in a new table or database!

Thanks for all of your responses!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top