Userforms Won't Close

D

dunnerca

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.
 
J

JLGWhiz

There is nothing wrong with that syntax. There could be other things wrong
but it is hard to tell from the info provided.
 
P

Peter T

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
 
D

dunnerca

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
 
J

Juan.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top