Userforms Won't Close
I found this online and it is also useful in closeing out all open forms...
Procedure CloseForms
local lnForms, llDone
lnForms = _SCREEN.FormCount
llDone = .T.
DO WHILE lnForms 0 AND llDone
if pemstatus(_SCREEN.Forms(lnForms),'QueryUnload' ,5)
llDone = _SCREEN.Forms(lnForms).QueryUnload()
endif
IF llDone
_SCREEN.Forms(lnForms).Release
lnForms = _SCREEN.FormCount
ENDIF
ENDDO
RETURN
Hope all helps...
J.
"dunnerca" wrote:
Thanks, Peter. The modal/non-modal issue cured the problem. I changed all
my "frm_name.hide" commands to "unload frm_name" and used the false argument
for the form.show command and it works fine. Many thanks for your knowledge.
Kevin
"Peter T" wrote:
I have checked to make sure the forms are
unloaded when another form is loaded.
How have you concluded that.
If your forms are model, although you can Hide a form as you load and.or
show the next form, they will all remain loaded until you unload the last
Form. Code will revert to the form that opened a form at which point you can
then unload it, all the way back to your first form.
Regards,
Peter T
"dunnerca" wrote in message
...
I have coding for an application that uses three userforms, a Main form, a
Team form, and a form for changes to team information. I have coded for
moving from form-to-form and back. Data moves correctly back and forth.
I
have checked to make sure the forms are unloaded when another form is
loaded.
There are no loops in the coding. However, when I click on a "browse"
command button on the Main form that closes the userform and goes to the
worksheet, one form stays open.
Without boring you all with extensive coding, is there something I'm
missing
about closing a form with "frm_Main.hide"? I tried coding for closing ALL
forms but the same thing happens. Any help would be appreciated as I've
been
all through this, forwards and backwards, and can't see the problem.
|