ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   close user form (https://www.excelbanter.com/excel-programming/367188-close-user-form.html)

ViestaWu

close user form
 
Could anyone get rid of my confusion?

I have two user forms. first is for user log in, named frmLog, second is
frm2. I'd like it do like this, if log in succeeds, frmlog close and frm2
shows.

......
frm2.show
unload frmLog
exit sub
....

but result is frmLog is still shown when frm2 could be seen, and frm is on
the front of frmLog. Why it is like this?

many many tks,
Viesta

Ardus Petus

close user form
 
Use frmLog.Hide instead of frmLog.Unload

HTH
--
AP

"ViestaWu" a écrit dans le message de news:
...
Could anyone get rid of my confusion?

I have two user forms. first is for user log in, named frmLog, second is
frm2. I'd like it do like this, if log in succeeds, frmlog close and frm2
shows.

.....
frm2.show
unload frmLog
exit sub
...

but result is frmLog is still shown when frm2 could be seen, and frm is on
the front of frmLog. Why it is like this?

many many tks,
Viesta




Bob Phillips

close user form
 
Call the login form from your main for, in the activate event. When you
close it, it then returns to main.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"ViestaWu" wrote in message
...
Could anyone get rid of my confusion?

I have two user forms. first is for user log in, named frmLog, second is
frm2. I'd like it do like this, if log in succeeds, frmlog close and frm2
shows.

.....
frm2.show
unload frmLog
exit sub
...

but result is frmLog is still shown when frm2 could be seen, and frm is on
the front of frmLog. Why it is like this?

many many tks,
Viesta




Shameem

close user form
 
Try this:

......
Unload frmLog
frm2.show
Exit sub.....


"ViestaWu" wrote:

Could anyone get rid of my confusion?

I have two user forms. first is for user log in, named frmLog, second is
frm2. I'd like it do like this, if log in succeeds, frmlog close and frm2
shows.

.....
frm2.show
unload frmLog
exit sub
...

but result is frmLog is still shown when frm2 could be seen, and frm is on
the front of frmLog. Why it is like this?

many many tks,
Viesta


Duncan[_5_]

close user form
 
Agree with Shameem,

when you show the next form, the code will stop until that form has
gone, so correct is to unload BEFORE showing or else your next line
after show will not activate until the form you have shown has gone.

I would avoid using hide.....unload at all instances where you need to
switch and then you will not get loads of forms hanging in the
background.

Duncan


Shameem wrote:

Try this:

.....
Unload frmLog
frm2.show
Exit sub.....


"ViestaWu" wrote:

Could anyone get rid of my confusion?

I have two user forms. first is for user log in, named frmLog, second is
frm2. I'd like it do like this, if log in succeeds, frmlog close and frm2
shows.

.....
frm2.show
unload frmLog
exit sub
...

but result is frmLog is still shown when frm2 could be seen, and frm is on
the front of frmLog. Why it is like this?

many many tks,
Viesta



ViestaWu

close user form
 
Thanks Duncan and Shameem, it really works.



"Duncan" wrote:

Agree with Shameem,

when you show the next form, the code will stop until that form has
gone, so correct is to unload BEFORE showing or else your next line
after show will not activate until the form you have shown has gone.

I would avoid using hide.....unload at all instances where you need to
switch and then you will not get loads of forms hanging in the
background.

Duncan


Shameem wrote:

Try this:

.....
Unload frmLog
frm2.show
Exit sub.....


"ViestaWu" wrote:

Could anyone get rid of my confusion?

I have two user forms. first is for user log in, named frmLog, second is
frm2. I'd like it do like this, if log in succeeds, frmlog close and frm2
shows.

.....
frm2.show
unload frmLog
exit sub
...

but result is frmLog is still shown when frm2 could be seen, and frm is on
the front of frmLog. Why it is like this?

many many tks,
Viesta





All times are GMT +1. The time now is 03:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com