469,575 Members | 1,658 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,575 developers. It's quick & easy.

Can I change an Error Message to direct user to correct field

I have a field in a table set to "Required". When a user is inputting data via a form and if they leave this field blank, Access automatically returns the following error message:

The field ‘tbl:Main.ClaimNumber’ can’t contain a Null value because the required property for this field is set to True. Enter a value in this field.

Can I change this message to say something different as the database is going to be used by many people and not all of them would know what the error message is asking them for?
Feb 14 '08 #1
2 1443
FishVal
2,653 Expert 2GB
Hi, Bruce.

Before Access shows the message Form_Error event is being triggered. You may write where a code showing custom message and change Access default behavior by setting the event argument value before exiting the sub.

Regards,
Fish
Feb 14 '08 #2
missinglinq
3,532 Expert 2GB
Here's an example:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Error(DataErr As Integer, Response As Integer)
  2. Dim Message As String
  3. If DataErr = 3314 Then 'Field is required and can't be NULL
  4. Message = "Your Custom Message Goes Here"
  5. Response = MsgBox(Message, vbExclamation, "This Field Must Contain Data!")
  6. Response = acDataErrContinue
  7. End If
  8. End Sub
Welcome to TheScripts, Bruce!

Linq ;0)>
Feb 14 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Morten Gulbrandsen | last post: by
11 posts views Thread by Yeah | last post: by
8 posts views Thread by Tony Williams | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.