Unwanted Error 2950 popup

PaulO

Registered User.
Local time
Today, 15:39
Joined
Oct 9, 2008
Messages
421
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

 
Put error error handler to your macro.
You should probably valudate entry on field level or form level, BedBeforeUpdate event.
 
Put error error handler to your macro.
You should probably valudate entry on field level or form level, BedBeforeUpdate event.

Is it not possible to amend the

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."

... to include an "(IF" at the front and "vbYesNo) = vbNo Then ... " at the back end, with clicking "No" then driving the required action?
 
the form error is an automation error. It's not a code error, it's just that the database rules prevent an action from working.

Therefore step through your code, because I presume after you try to add the record, and get the 3022 error, you are THEN getting a further 2950 error.

However - I just tried error 2950, and there is no 2950 error? Do you mean the 3022 error is repeating? In which case you probably have a logic error that is trying to achieve the erroneous record write twice, giving you the same message twice.
 
the form error is an automation error. It's not a code error, it's just that the database rules prevent an action from working.

Therefore step through your code, because I presume after you try to add the record, and get the 3022 error, you are THEN getting a further 2950 error.

However - I just tried error 2950, and there is no 2950 error? Do you mean the 3022 error is repeating? In which case you probably have a logic error that is trying to achieve the erroneous record write twice, giving you the same message twice.

So, on further checking I note that I had put a 'Refresh' macro (RunCommand>Refresh) on the next field which must have also errored at the same time as the 3022 Error. I have now removed this command and the 2950 error now does not arise.

Thanks to arnelgp and gemma-the-husky for their support in this matter, very much appreciated!
 

Users who are viewing this thread

Back
Top Bottom