Trapping an error

KenHigg

Registered User
Local time
Today, 02:52
Joined
Jun 9, 2004
Messages
13,289
What would be the best pc of code to use to trap the sys dup value error to display a more user friendly error message and where would the best place to insert the code? I think it's err 3022...

thxs, ken
 
I don't know what error it is but I seem to remember trapping that error number at the form level with the Error event.
 
Thanks - I was leaning in that direction but it seems some kind of table rule is firing off a message first...

kh
 
Hum....

Seems the dup val message dialog has changed to one with out a err number...

To be continued...

kh
 
Hello Ken!
Look at DemoErrA97.mdb
(MStef alias Štef)
 

Attachments

That's it!

Thanks - Is it still raining there?

kh
 
What I would do is first get the error and see the error code.
I would make an error trapping something like this:

Private Sub Insert_Click
On Error Goto Err_Insert_Click

On Error Resume Next
Insert ......
On Error Goto Err_Insert_Click
If Err=xxxx Then
MsgBox "Nope"
Exit sub
End if

:Exit_InsertClick
Exit Sub

:Err_InsertClick
Msgbox Err
Goto Exit InsertClick

hth.
SWK

ups......too late......
 
Thank you Sun, I'll give your suggestion a look as well - :)
 

Users who are viewing this thread

Back
Top Bottom