A toolbar will appear in the _Screen.Forms collection, but a toolbar doesn't have a QueryUnload() event. You might check the presence of the method before calling it:
IF PEMStatus(oForm, "QueryUnload", 5)
IF oForm.QueryUnload()
...
ENDIF
ENDIF
HTH
>I tried your suggestion but i get a ' Property QueryUnload is not found ' message, although I know it's there. What am I missing.
>
>I guess I should tell you that this code is running from a toolbar button. I'm using a "login as a different user", and that's why I need to close all running forms.