PDA

View Full Version : Userform will not Show after being Hidden



scott56
07-02-2008, 06:15 PM
I would like to do the following

- accept entry and selection on a Userform
- hide that form
- show another form for processsing
- unload the 2nd form
- show the original form with the entry and selection as before the hide

Is this possible ?

At the moment I have


Form_ContactDebtors.Hide
Form_Send.Show
Load Form_ContactDebtors


It Hides the original form ok and also shows the progress form....but it does not Load or show the original form after the Form_Send is unloaded...

Any help appreciated

mikerickson
07-02-2008, 06:40 PM
Put something like this in the second userform's code module.


Private Sub UserForm_Terminate()
Me.Hide
Form_ContactDebtors.Show
End Sub


The Load line is not needed.

scott56
07-02-2008, 07:11 PM
Put something like this in the second userform's code module.


Private Sub UserForm_Terminate()
Me.Hide
Form_ContactDebtors.Show
End Sub


The Load line is not needed.
Thanks for that....I included that as suggested and the form did show again....but this time if I go to select the Form_Send for another set of processing it comes up blank and uninitialised for some reason......

mikerickson
07-02-2008, 08:43 PM
When a userform is unloaded, the values of the controls are lost.
Those values need to be read and stored somewhere (in a cell, in a public variable..) if they are to be used again.

In this sequence,
pseudo-code

UserForm1.Show
Unload Userform1

Userform1.Showwhat is shown the second time is a different instance of Userform1. The first form seen is a differenent object than the second and, so, doesn't have the same values in the same controls. (Unless you put them there explicitly)

You could hide Form_Send rather than unloading it.