Borislav,
Ask the form's permission.. the QueryUnload() call I added into your code.
Some people use QueryUnload() returning .f. to indicate that the form can not be closed at the moment for whatever reason.
>Thanks David, but what I am doing wrong?
>Ask permission to post code here or ask permission to close the form?