Hi I have customised two error messages using the vb script below, which were copied from the net. The new error messages are only displayed when using the forms navigation buttons. Also on my form is a command "Save" button which when pressed only activates the default error massages.
Is there a way to make my "Save" button display the new error messages when pressed?
I am a novice to access so don't get too technical.
Private Sub Form_Error(DataErr As Integer, Response As Integer)
' If an error occurs because of duplicate data in a required field
' Display own custom error message
Const conErrDuplicateKey = 3022
Const conErrZeroKey = 3058
Select Case DataErr
Case conErrDuplicateKey
MsgBox "This Serial Number already exsists: " & Search, , "Warning Duplicate Record!"
Response = acDataErrContinue
Case conErrZeroKey
MsgBox "You Must Enter a Serial Number before you Save the Record: " & Search, , "Warning No Serial Number!"
Response = acDataErrContinue
Case Else
'Display a standard error message
Response = acDataErrDisplay
End Select
End Sub
Is there a way to make my "Save" button display the new error messages when pressed?
I am a novice to access so don't get too technical.
Private Sub Form_Error(DataErr As Integer, Response As Integer)
' If an error occurs because of duplicate data in a required field
' Display own custom error message
Const conErrDuplicateKey = 3022
Const conErrZeroKey = 3058
Select Case DataErr
Case conErrDuplicateKey
MsgBox "This Serial Number already exsists: " & Search, , "Warning Duplicate Record!"
Response = acDataErrContinue
Case conErrZeroKey
MsgBox "You Must Enter a Serial Number before you Save the Record: " & Search, , "Warning No Serial Number!"
Response = acDataErrContinue
Case Else
'Display a standard error message
Response = acDataErrDisplay
End Select
End Sub