Limit an Access 2013 Text Box to Two Decimal Places
Question details
Limit numeric input in an Access 2013 text box to two decimal places while displaying decimal digits only when needed.
- Product
- Microsoft Access 2013
- Device & OS
- not provided
- Scenario
- A form text box should accept numeric values with zero, one, or two decimal places.
- Observed behavior
- Values should display without unnecessary trailing decimal zeros, and values requiring more than two decimal places should not be accepted.
Open the form in Design View and identify the text box name and its underlying field type. If the text box is bound to a numeric field, check the field's precision and scale so Access does not round the value before validation.
Format and validate the Access text box before updating
Use this approach to reject numeric values that require more than two decimal places while displaying only needed decimal digits.
Open the form in Design View, select the text box, and open its Property Sheet. On the Format tab, set Format to General Number and Decimal Places to Auto.
On the Property Sheet's Event tab, select Before Update, choose [Event Procedure], and click the ellipsis button to open the VBA editor.
Inside the generated BeforeUpdate procedure, add the following code, replacing Text0 with your text box name: If Not IsNull(Me!Text0.Value) Then If CDec(Me!Text0.Value) * 100 <> Fix(CDec(Me!Text0.Value) * 100) Then MsgBox "Enter a value with no more than two decimal places." Cancel = True End If End If
Save the form, open it in Form View, and try values such as 12, 12.3, 12.34, and 12.345. The last value should trigger the message and prevent the update.
Round the text box value after updating
Use rounding if changing values with extra decimal places is acceptable instead of rejecting them.
Work with numeric data in WPS Spreadsheets
WPS Office is a free, lightweight alternative for working with spreadsheet data in a familiar interface. Open compatible Office files to move your work between applications. WPS Spreadsheets does not fix or replace Access form controls.

Frequently Asked Questions
Does General Number prevent users from entering extra decimal places?
No. Set Format to General Number on the text box Property Sheet to control display, then use a Before Update event to validate the value.
Why does the validation accept 1.2300?
The value-based check treats 1.2300 as the same numeric value as 1.23. To count every typed digit, validate the text entered in the control before it is converted or normalized.
Can I round instead of rejecting a value?
Yes. Add a VBA Round call to the text box's After Update event, but note that this changes the value and uses banker's rounding for midpoint values.
Can an input mask limit decimal entry?
An input mask may constrain the pattern users enter. Set it through the text box's Input Mask property, but test whether the mask allows the optional decimal digits you need.
Why is a value already rounded before my check runs?
The underlying field's data type, precision, or scale can affect the stored value. Check the field in the table's Design View and test the form's validation with that field configuration.




