-
Validating Numerical Data Entry
To disallow any data entry problems, you can set the vaildation rule for a field (using the table design view). Set it to: <=500
In the textbox on the form where you do not want a user to enter a value >500, then in the BeforeUpdate event enter something like this
[vba]Private Sub txtValue_BeforeUpdate(Cancel As Integer)
If Me.txtValue > 500 Then
MsgBox "Do Not Enter Over 500 Sheets", vbCritical, "Please re-enter."
Me.txtValue.SetFocus
End If
End Sub[/vba]The value that was entered in the textbox will remain there but not update until a value <= 500 is entered. Pressing ESC will return it to the original value before the invalid value was entered.
I think it is better to enter data using a form and use the BefureUpdate event code as you have more control over the error message diplayed.
I hope I understood your question. If not, post back. I (or someone else) will try to help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules