How to Change Table Validation Error Message in MS

2019-08-02 01:03发布

I've got a set of fairly complicated table validation rules that I'm using to keep my data clean in one of my MS Access tables. The rules appear to be working well, but when a rule is violated it generates a nasty-looking error message. The whole string of rules comes up in the message - not exactly user-friendly.

I've tried to replace the message using code similar to this in the form's OnError event:

Private Sub Form_Error(DataErr As Integer, Response As Integer)
  If DataErr = 2601 Then
    MsgBox ("Case Number already entered")
    Response = 0
  End If
End Sub

However, apparently I haven't managed to find the correct error number because the If statement never fires. I checked here, but apparently it's not 3317 or 4001.

Also, when I removed the If statement and just had the MsgBox fire on any error, the standard error came up along with the message box - it's not being replaced.

Any idea how to address these issues?

0条回答
登录 后发表回答