Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trapping Access Error 3200

Status
Not open for further replies.

ChemistZ

Programmer
Oct 30, 2001
70
US
I have another post that is related to this one. In my claim form, if I change the key and then tab until I would normally go to the next record, I get error 3200. What I would like to do is trap it. So, I tried putting in the OnCurrent event this code

on Error Goto err_try
err_try:
if err=3200 then
msgbox "blah blah blah"
sendkeys "{esc}" to put form back the way it was
end if

However, I continue to get error 3200 instead of my message box. Have i tried the wrong event? I also tried before and after update and lostfocus. Help!!
 
Hi!

Try If Err.Number = 3200 Then

hth Jeff Bridgham
bridgham@purdue.edu
 
I changed it but I still get that standard error message. It just has to be the OnCurrent event doesn't it?
 
Hi!

That depends on what error 3200 is. You may need to trap it in the before update event procedure instead or the after update procedure.

hth Jeff Bridgham
bridgham@purdue.edu
 
I just tried putting the code into the before update event and then the afterupdate event and it still doesn't trap the darn thing. Any ideas?
 
Hi!

Could you tell me what error 3200 says?

Jeff Bridgham
bridgham@purdue.edu
 
The record can not be deleted or changed because there are related records in the [table name] table.
 
Aah!

I hate to say this, but you can't trap that error because it has nothing to do with code or the form. This error is indicating that an established relationship between two tables would lose its integrity if the action is performed. The error occurs before any code is run so it isn't trappable. About all you can do is to set up an artificial relationship between the tables(an autonumber) and test the relationship between the fields yourself to provide the user with options. The only other possibility would be to set up the cascade delete and update in the relationship box, but that opens up your data to careless users.

hth
Jeff Bridgham
bridgham@purdue.edu
 
I am curious as to why then the help feature lists 3200 as one of the trappable errors?
 
Hi!

I'm not sure why that is. I am working in A2K and it isn't listed as trappable there. I set up a small test db and forced the error and it came up without a number on it. So I tried to trap it and found that it's number is zero, at least in A2K. What I did that worked was:

If Err.Number = 0(or 3200 in your case) Then
Your error message
Me.Undo
End If

I put this in the before update event.

hth Jeff Bridgham
bridgham@purdue.edu
 
Thanks I figured it out. I put the code I had before in the OnError event and that worked like a charm.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top