XelaIrodavlas
Registered User.
- Local time
- Today, 15:07
- Joined
- Oct 26, 2012
- Messages
- 175
Hi all,
Please help, I'm having some trouble with a control on a form: The control asks for a value between 0 and 50, so naturally I entered the Validation rule <=50. I haven't used a lot of validation rules (for some reason) but that seems to work, so that's not really the problem.
If a user enters a value outside of the range they receive the message:
This doesn't mean a lot to the average user, so I was trying to capture the error and replace it with a more meaningful message.
I started with the following code, which I tried entering into the form's On Error event:
But this doesn't seem to work, I added 'msgbox Err.number' to the top and it then came out with 0, suggesting this wasn't triggering as an error on the form.
Is there another approach I can use? Or can you just not capture validation errors in this way?
Any thoughts much appreciated
Thanks,
Please help, I'm having some trouble with a control on a form: The control asks for a value between 0 and 50, so naturally I entered the Validation rule <=50. I haven't used a lot of validation rules (for some reason) but that seems to work, so that's not really the problem.
If a user enters a value outside of the range they receive the message:
Access Error 2107 said:The value you entered does not meet the validation rule defined for the field or control.
To see the validation rule, switch to Design view or Layout view, click the appropriate field, and then, if the property sheet is not open, press F4. Then, click the Data tab in the property sheet.
Enter a value that meets the validation rule, or press ESC to undo your changes.
This doesn't mean a lot to the average user, so I was trying to capture the error and replace it with a more meaningful message.
I started with the following code, which I tried entering into the form's On Error event:
Code:
Select Case Err.Number
Case 2107
MsgBox "Please enter a number between 0 and 50."
End Select
But this doesn't seem to work, I added 'msgbox Err.number' to the top and it then came out with 0, suggesting this wasn't triggering as an error on the form.
Is there another approach I can use? Or can you just not capture validation errors in this way?
Any thoughts much appreciated

Thanks,