Results 1 to 2 of 2
Thread: Force Fields (2000)
2003-12-18, 15:01 #1
- Join Date
- May 2003
- Manchester, Gtr Manchester, England
- Thanked 0 Times in 0 Posts
Force Fields (2000)
Good afternoon, I have a number of fields where the property is required. Rather than a system generated message telling users that a field is needed and one that doesn't make a great deal of a sense to them, how can I tailor a meaningful message.
2003-12-18, 15:19 #2
- Join Date
- Mar 2002
- Thanked 28 Times in 28 Posts
Re: Force Fields (2000)
You must handle this in a form. Write an event procedure for the On Error event of the form as a whole:
Private Sub Form_Error(DataErr As Integer, Response As Integer)
Select Case DataErr
Case 3314 ' Required field is empty
MsgBox "You have left this very important field empty." & _
vbCrLf & "Please fill it in now.", vbExclamation
MsgBox "Error " & DataErr & " occurred, with description:" & _
vbCrLf & AccessError(DataErr), vbExclamation
Response = acDataErrContinue
The DataErr argument contains the number of the error that occurred; if the user leaves a required field empty, thr error number is 3314.
The Response argument is acDataErrDisplay by default, i.e. show the standard error message. If you set Response to acDataErrContinue in your procedure, the standard error message is suppressed.
You can add other Cases if you want to handle other errors yourself.
Note: an alternative to setting Required to Yes in the table is to set Validation Rule to Is Not Null and to enter your custom error message in Validation Text.