Welcome to the board. Please read up in the FAQ on how to post code

You need to check your IF / ENDIF i.e. You're missing ENDIF for your code.

Each IF needs an ENDIF