Kent, it looks like you have an ENDSELECT where you'd want an ENDIF. And i think you should also move that username=Dir() down a level, because it'll just keep looping if username = '.'

Les, what's the problem with looping on @error if the last statement, the Dir() assignment, sets @error? I've never had a problem with it in that situation.
_________________________
Eric