I have introduced the following code in the Onerror properties of a Form, to advise the user that he is attempting to enter a duplicate record. The code itself works well but perhaps doesn't go far enough in so far as the popup message it generates then only allows the user to click "OK" ...which is then followed by a 2950 error message to which the user then has to click "Stop All Macros". Seemingly, for users in a Runtime environment this then crashes/closes the database.
So, what I'd like to enable the user to do is click to the "OK" and for the record to either reset itself or, perhaps easier, the form to close and not therefore not allowing the 2950 to do its thing. How do I achieve this?
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 3022 Then
Response = acDataErrContinue
MsgBox "LoftOrganiser does not permit duplicate entries to be made and has determined that this pigeon record already exists. Please modify or delete this entry."
End If
End Sub
So, what I'd like to enable the user to do is click to the "OK" and for the record to either reset itself or, perhaps easier, the form to close and not therefore not allowing the 2950 to do its thing. How do I achieve this?
Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 3022 Then
Response = acDataErrContinue
MsgBox "LoftOrganiser does not permit duplicate entries to be made and has determined that this pigeon record already exists. Please modify or delete this entry."
End If
End Sub