View Single Post
  #5  
Old May 9th, 2007, 12:09 PM posted to microsoft.public.access.tablesdbdesign
Access Joe
external usenet poster
 
Posts: 118
Default Custom Validation Text message

That worked PERFECTLY. Thanks Fred!

"fredg" wrote:

On Tue, 8 May 2007 14:25:01 -0700, Access Joe wrote:

Would you be able to tell me where and how the code would be written on the
form field?

"Larry Daugherty" wrote:

Tables don't offer much in the way of user interface tools. To do
what you want, do your validation in code at the form level and use a
message box.

HTH
--
-Larry-
--

"Access Joe" wrote in message
...
Hey everyone,

In my table, when a user enters a value that doesn't match my
validation
requirements, it prompts them with an error message. I've
customized the
'Validation Text' field so a custom message comes up.But, is it
possible to
display the "current entry" on this message (the actual entry that
prompted
the error)?

I.E. If a person types the number "200" in a field validated to
only
accepts 100 or less, I would like the mssage to say something like:
"200 does
not fall within the specific range. Please try again."

Any help would be appreciated. Thanks!



Here's how you can find the correct error and show your own message
for any of the form level errors.

First code the Form's Error event:

MsgBox "Error#: " & DataErr ' Display the error number
Response = acDataErrDisplay ' Display Default message

Then open the form and intentionally make that error.

The message box will display the error number and the default error
message.

Next, go back to the error event and change that code to:

If DataErr = XXXX Then
Response = acDataErrContinue ' Don't display the default message
MsgBox "Please enter data in all required fields."
Else
MsgBox "Error#: " & DataErr
Response = acDataErrDisplay ' Display Default message
End If

where XXXX is the error number.

I believe your Validation Rule error raises error # 7753
So code your form's Error event:

If DataErr = 7753 Then
MsgBox "Your entry of " & Me![YourControlName].Text & " must be
less than 100."
Else
MsgBox "Error#: " & DataErr
End If
Response = acDataErrContinue

The error message will read:
"Your entry of 200 must be less than 100."


--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail