There is no such thing as END IF with KiXtart.
That is VB style coding.

It is EndIf