Err value dilema

T

Tony_VBACoder

I stumbled upon an old code example on the Web that checks
the value of "err", and was trying to clean it up a bit,
when I ran into a dilema as to why the code is behaving
the way it is:

If Err = 71 Then
' Do This....
ElseIf Err = 68 Then
' Do This...
ElseIf Err = 75 Or 76 Then
' Do This...
ElseIf Err = 3043 Then
' Do This...
Else
' Do This...
End If


The problem I have is, if I set a "watch" on the Err
value, and it is 52, for some reason the code jumps into
the ElseIf where Err = 75 or 76. Why is this?????
Shouldn't it gointo the final Else statement?
 
M

M.L. Sco Scofield

Actually, anything that's not 71 or 68 will stop on that check.

Try: ElseIf Err = 75 Or Err = 76 Then

Good luck.

Sco
 
T

Tony_VBACoder

Yes, that makes sense. Instead, I changed the entire
IfThenElse to a CASE statement.

Thanks
 

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