On Sep 11, 1:17*am, Mike S <ms...@yahoo.com> wrote:
> On 9/10/2010 4:04 AM, noname wrote:
>
>
>
>
>
>
>
>
>
> > Hi,
>
> > I have a form with multipage containing 4 pages. Each page has frame
> > with controls like textboxes and comboboxes on it.
>
> > By clicking the Red X on title bar, i hide the form and load a
> > messagebox with Yes, No& *Cancel buttons. If Cancel is chosen, the
> > hidden userform is made visible. But here's the catch, i need to open
> > the same page i was on, at the time of form hiding. Since on every
> > page, i have a button that has code which opens and initializes
> > controls on the next page, i need to know, can i call the button code
> > from the form initialize event, using an IF condition like this:
>
> > Userform_Initialize()
> > .......
> > .......
> > * * *If p = 0 Then
> > * * * * *'normal form initialization code....
> > * * *ElseIf p = 1 Then
> > * * * * *Call eqForm.cmd_AddBrands_Click
> > * * *ElseIf p = 2 Then
> > * * * * *Call eqForm.cmd_AddFactors01_Click
> > * * *ElseIf p = 3 Then
> > * * * * *Call eqForm.cmd_AddFactors02_Click
> > * * *End If
> > End Sub
> > Anybody has ideas how to do this, instead of copy- pasting the
> > individual button_Click codes again into the form initialize event.
>
> Try this:
>
> If p = 0 Then
> * * *'normal form initialization code....
> ElseIf p = 1 Then
> * * *eqForm.cmd_AddBrands.Value = True
> ElseIf p = 2 Then
> * * *eqForm.cmd_AddFactors01.Value = True
> ElseIf p = 3 Then
> * * *eqForm.cmd_AddFactors02.Value = True
> End If
Thanks Mike,
You are fantabulous
This works!!!