• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 538
  • Last Modified:

Access - prevent Access error message for a required field (when left blank)

On The field <name> cannot contain a Null value because the Required property for this field is set to True. Enter a value in this field. (Error 3314)

 I created a custom error message to replace the access error message above. See code below, First a trap error 3314 and my custom message appears but then the standard Access 3314 error message also appears right after.
How do I prevent the Access message.

What code is needed - Where do I put code and in what event.

this is my code in the form in the ON error event

Private Sub Form_Error(DataErr As Integer, Response As Integer)
DoCmd.SetWarnings False
Const conErrDataValidation = 3314
 
Select Case DataErr
   Case conErrDataValidation, conErrDataType
      MsgBox "You must enter a participant status"
End Select
DoCmd.CancelEvent

End Sub
0
lbec
Asked:
lbec
1 Solution
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
acDataErrContinue
Private Sub Form_Error(DataErr As Integer, Response As Integer)
DoCmd.SetWarnings False
Const conErrDataValidation = 3314
 Response = acDataErrContinue               '  ***** add this here
Select Case DataErr
   Case conErrDataValidation, conErrDataType
      MsgBox "You must enter a participant status"
End Select
DoCmd.CancelEvent

End Sub
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now