Err.number

N

Norma

How can I write a code to protect the error to do a
certain thing I want. Let say If err#2651 pop the program
will close a certain form.

Thanks
Norma
 
F

fredg

How can I write a code to protect the error to do a
certain thing I want. Let say If err#2651 pop the program
will close a certain form.

Thanks
Norma

Don't quite understand what you mean by "pop the program will close a
certain form.", but if you wish to run certain code if that error
occurs you would code the error handling section of your procedure:

On error GoTo Err_Handler

' Place your normal code here

Exit_this_Sub:
Exit Sub

Err_Handler:
If Err = 2651 Then
' Do something here
Else
' Do something else here
End if

** Don't forget to Resume someplace....
 
N

Norma

where should I place this code. Normally it will have
error when I click "Employee Button", so should I just
put it under "employee button".

Thanks again,
Norma
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top