Error trap referential integrity

JohnGo

Registered User.
Local time
Today, 09:06
Joined
Nov 14, 2004
Messages
70
I've written a general error trap function within a module with several error codes. I call the funtion within several forms with different arguments specific for the form.

I want to error trap referential integrity also, currently I have referential integrity enabled with only the update option. So my relations are set to required = you can't delete the record in the parent table when another table still beholds the value in the foreign key.
This is nice but the message popping up isn't nice as users won't understand it (table xx still has this value ..etc). They only see forms and not tables so they won't understand the Access-message.

If I want to error trap it per form to make the error more understandable i need the error-code of required messages but can't find it. Anybody knows the access internal error-code for this kind of message?
 
normally you should get the error code by clicking 'help' when the error message pop-ups but no help button is there
 
solved?

Gee, in another form the help pops-up with error code 3396

end of topic
 
Last edited:
and in another one without an error code and can't trap the stupid error
 
In the form's Error event, put MsgBox DataErr to get the error number. You should be able to trap it with this event.
 
McAbney, I tried but it only shows the original message.
probably access doesn't see it as an error?

The strange thing is one time it's 3200, other time it's 3396 and these error traps work well. But within one form access automatically responds with a message without error Id while my relations are still referential with only autoupdate. Quite odd.

The message also doesn't have the help button, normally via the help i'm able to track the error code related to the message.
I tried via the code msgbox dataerr but it didn't help .
I've tested or msgbox dataerr is working by generating errors and it does work by returning the error code, except for that one required referential message.
 
Hi Pat, A similar thing I'm using but in one case there's a referential error without an error code. If there's no code nothing can be trapped.
But this way i trap 95% of the referential errors so it's quite ok
 

Users who are viewing this thread

Back
Top Bottom