The best way to handle that is either to have a function that you call to open any forms that get opened and another function to close forms. Then you can add the form name to an array when you open it and delete it from the array when you close it.
Or, have the form add itself and delete itself from the array when it opens or closes.
After that what you are looking for is a snap.
Alan
>Hi Tracy, Thanks for your reply.
>
>The main purpose is , if there are any open forms, not to Quit the App.
>I still want the user to actually close the forms, I just want to do a test.
>If any open forms
> Messagebox('There are Open Forms..you cannot exit')
> Dont Quit
>Endif
>
>But I was getting up a count of 4 when it appears to me that there are no open forms
>
>regards,
>
>Gerard
>
>
>
>>Is the goal to close all open forms? Or just check the number of open forms?
>>
>>
>>LOCAL lnForms, llDone
>>lnForms = _SCREEN.FORMCOUNT
>>llDone = .T.
>>DO WHILE lnForms > 0 AND llDone
>> llDone = _SCREEN.FORM(lnForms).QUERYUNLOAD()
>> IF llDone
>> _SCREEN.FORM(lnForms).RELEASE
>> lnForms = lnForms - 1
>> ENDIF
>>ENDDO
>>
>>
>>
>>>Hi.
>>>I have a button which allows exit out of an app, but before I do so I check _Screen.FormCount to check the no. of open forms.
>>>
>>>This .most of the time returns 4 when I have no open forms, but all I have open is A Menu and a Toolbar.
>>>
>>>Is this the right command or is there a better way. ?
>>>
>>>Regards,
>>>
>>>Gerard