Is Error is fighting with On Error

Is Error is fighting with On Error

JBEDsol
Collaborator Collaborator
426 Views
4 Replies
Message 1 of 5

Is Error is fighting with On Error

JBEDsol
Collaborator
Collaborator

I have a code w/ some error checking.  On Error goto......  The problem is when I'm trying to find something missing I get an error. I want to do an if then checking if something exists. if it's an error then I know it doesn't exist.  If it's not an error I can get the value.  Problem is if there's an error it goes to the error checking area.  I just want to check if there's an error rather than go to the error checking. 

0 Likes
427 Views
4 Replies
Replies (4)
Message 2 of 5

Rene_Gerlach
Advocate
Advocate

Maybe you can try:

 

on error resume next

if err.number <> 0 then somthing went wrong

0 Likes
Message 3 of 5

JBEDsol
Collaborator
Collaborator

The issue is I'm trying to find if there's an error or not for one specific situation.  If I use resume next then I skip the error checking.  I want error checking for other errors.  But in one specific case I just want to see if it's an error or not without actually causing the error.

0 Likes
Message 4 of 5

Rene_Gerlach
Advocate
Advocate

Hope I understand you right.

You can call 

On Error Resume next

before the call you are interested in. Then check the Err.Number and after this reset to the default error handling with On Error Goto 0

or with

On Error Goto <line>

If this is not what you need could you explain the "specific case"? 

0 Likes
Message 5 of 5

JBEDsol
Collaborator
Collaborator

Thanks, I'll try that and see if it works out.

0 Likes