By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,428 Members | 1,109 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,428 IT Pros & Developers. It's quick & easy.

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

P: 20
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
Share this Question
Share on Google+
2 Replies

Expert 2.5K+
P: 2,653
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.

Feb 14 '08 #2

Expert 2.5K+
P: 3,532
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.