IF !EMPTY(WONTOP()) * There is a form open here, since I have a master form that is always opened this should always return * something. But it is blank if the report preview window is open. Do oApp.CloseApp else * Skip shutdown, the Report Preview seems to be open endif