I have a field in a form, report number. It has to have 10 characters. I made the max 10 characters in the table. However, users can still enter less than 10. I don't want less than 10 characters, I want exactly 10. How would I go about doing that?
I have a field in a form, report number. It has to have 10 characters. I made the max 10 characters in the table. However, users can still enter less than 10. I don't want less than 10 characters, I want exactly 10. How would I go about doing that?
If it's a number field you cold format as 0000000000 so numbers with less than 10 digits will be preceded by leading zeroes as necessary.
If it's text, use an input mask or possibly a validation rule.
It's a text field. I have an input mask, but the mistake is still being done. The zeros won't work because I don't want any zeros preceding it.
You can use a Validation Rule right on the table field itself, or you can use some BeforeUpdate VBA script on the Form.
This example shows both ways: https://www.pcreview.co.uk/threads/v...field.2934160/
Are these existing report numbers or are they making them up?
If existing use a combobox.
If they are making them up, are duplicates allowed?
validation rule Len([field name])=10
The report numbers are given. Yes, duplicates are allowed.
JoeM, that worked perfectly. Thanks.
You are welcome.