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

How to Stop Numeric Textbox Validation Rounding?

Status
Not open for further replies.

harleychick

Programmer
Jun 10, 2002
16
US
I have a textbox that has a validation rule >=0 AND <=25. The format for the text box is Fixed, Zero decimal places. If I enter -0.4 it rounds the entry to zero instead of displaying the Validation Text that the number is less than zero and is invalid. How do you make the textbox only accept numbers >=0 without rounding?
 
A little more info I have discovered. The validation rounds and excepts -0.4 because it is bound to an integer field in a SQL table. When I change the field type to a float, the validation works as expected and trows back the invalid data error. Any suggestions?
 
If your data type is Integer, Access will ignore the decimal portion of the data. Entering a value of 0.4 or -0.4 will be rounded to 0 and falls within your validation rules. I'd change the data type to Double.


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top