Put DEBUG ON into the first line of your code, step through it and evaluate your variable contents. I do not believe that those four lines of code are failing in itself. Most likely it's something in the code that you did not post.

And don't forget the ENDIF to close the IF structure.
_________________________
There are two types of vessels, submarines and targets.