croy said:
I haven't been able to get any different results that way,
but I don't know if I'm doing it right.
I put this in the On Error event:
***
Private Sub Form_Error(DataErr As Integer, Response As
Integer)
On Error GoTo Err_Form_Error
Exit_Form_Error:
Exit Sub
Err_Form_Error:
MsgBox Err.Number
Resume Exit_Form_Error
End Sub
***
That won't do anything, in itself. If it's going to work at all, we need
the body of the event procedure to examine the value of DataErr, decide that
it's the one we want to ignore, and then set the Response argument to
acDataErrContinue. For now, since I don't know the number of the error,
modify your procedure like this:
'----- start of code -----
Private Sub Form_Error(DataErr As Integer, Response As Integer)
On Error GoTo Err_Form_Error
MsgBox "Error " & DataErr & " was raised."
Response = acDataErrContinue
Exit_Form_Error:
Exit Sub
Err_Form_Error:
MsgBox Err.Description, vbExclamation, "Error " & Err.Number
Resume Exit_Form_Error
End Sub
'----- end of code -----
Then trigger the error as you have been doing, and see if you get the
message from the event procedure. If you do, you can change the event
procedure to this:
'----- start of code -----
Private Sub Form_Error(DataErr As Integer, Response As Integer)
On Error GoTo Err_Form_Error
If DataErr = <the error number> Then
Response = acDataErrContinue
Else
Response = acDataErrDisplay
End If
Exit_Form_Error:
Exit Sub
Err_Form_Error:
MsgBox Err.Description, vbExclamation, "Error " & Err.Number
Resume Exit_Form_Error
End Sub
'----- end of code -----