error code not working

slcollie

Registered User.
Local time
Today, 15:08
Joined
Jun 6, 2000
Messages
20
I am trying to create a warning which tells the user they have violated a multiple index by adding repeating data, but it does not work. Here is code.

private sub form_error(dataerr as integer, response as integer)

if dataerr <> 3022 then exit sub
Call msgbox ("You have entered repeating data",vbOKonly)
response = cancel
end sub
 
I'm afraid it didn't work, nothing happens and I don't know why.

SARAH
 
Try using this code

If DataErr = 3022 Then
Msgbox("...your message....",vbOkOnly)
Response = acDataErrContinue
End sub

HTH
 
No, still nothing.

This code was given to me by someone - do you think the 3022 part is not recognised?
 
OK what you need to do is delete the code in form's error event so that you can generate the error and Access will display the standard error message along with the error number.

Make sure that this error number is included in the code I gave you and try it again. Let me know how you get on.
 

Users who are viewing this thread

Back
Top Bottom