Opening One Form From Another and Minimizing the First

  • Thread starter Thread starter croy
  • Start date Start date
C

croy

When I have a command button on one form, to open aother
form, I'd like to have the first form minimize, and restore
(automatically) when the second form closes.

I think I can handle everything up to the point of wanting
to restore the first form.

Anybody care to offer a clue or two?
 
When I have a command button on one form, to open aother
form, I'd like to have the first form minimize, and restore
(automatically) when the second form closes.

I think I can handle everything up to the point of wanting
to restore the first form.

Anybody care to offer a clue or two?

Make it not visible when you open the second form.
On Form1:

DoCmd.OpenForm "Form2"
Me.Visible = False

Make it visible again when you close the second form.
On Form2:

DoCmd.Close acForm, Me.Name
Forms!Form1.Visible = True

Change "Form2" and Form1 to whatever the actual names of the two forms
are.
 
Make it not visible when you open the second form.
On Form1:

DoCmd.OpenForm "Form2"
Me.Visible = False

Make it visible again when you close the second form.
On Form2:

DoCmd.Close acForm, Me.Name
Forms!Form1.Visible = True

Change "Form2" and Form1 to whatever the actual names of the two forms
are.


Thanks Fred. That seems to work very well.
 
Make it not visible when you open the second form.
On Form1:

DoCmd.OpenForm "Form2"
Me.Visible = False

Make it visible again when you close the second form.
On Form2:

DoCmd.Close acForm, Me.Name
Forms!Form1.Visible = True

Change "Form2" and Form1 to whatever the actual names of the two forms
are.


Thanks! Working good.

After using it, I realize now that I'd like to refine it
another increment...

When I click the button on form1, to make form1 invisible,
and form2 visible, is there a way to have the focuse move to
a specific control on form2? There doesn't seem to be an
"on visible" event ;-l .

I've tried setting the focus:

*****
If formIsLoaded("frmIvSurvDE") Then
If Not Me.NewRecord Then Me.Dirty = False
Forms!frmIvSurvDE!cboIvType.SetFocus
Forms!frmIvSurvDE.Visible = True
Me.Visible = False
Else
Me.Visible = False
DoCmd.OpenForm frmIvSurvDE
End If
*****

.... but it doesn't seem to take.
 
Thanks! Working good.

After using it, I realize now that I'd like to refine it
another increment...

When I click the button on form1, to make form1 invisible,
and form2 visible, is there a way to have the focuse move to
a specific control on form2? There doesn't seem to be an
"on visible" event ;-l .

I've tried setting the focus:

*****
If formIsLoaded("frmIvSurvDE") Then
If Not Me.NewRecord Then Me.Dirty = False
Forms!frmIvSurvDE!cboIvType.SetFocus
Forms!frmIvSurvDE.Visible = True
Me.Visible = False
Else
Me.Visible = False
DoCmd.OpenForm frmIvSurvDE
End If
*****

... but it doesn't seem to take.

To have the Form2 form always open to a particular control, either:
1) Set that control's Tab Index to 0.
(or set the form's Tab Order in the Tab Order Dialog. Click on View +
Tab Order)
or..

2) Code Form2's Load event:
Me.[ControlName].SetFocus
 
Thanks! Working good.

After using it, I realize now that I'd like to refine it
another increment...

When I click the button on form1, to make form1 invisible,
and form2 visible, is there a way to have the focuse move to
a specific control on form2? There doesn't seem to be an
"on visible" event ;-l .

I've tried setting the focus:

*****
If formIsLoaded("frmIvSurvDE") Then
If Not Me.NewRecord Then Me.Dirty = False
Forms!frmIvSurvDE!cboIvType.SetFocus
Forms!frmIvSurvDE.Visible = True
Me.Visible = False
Else
Me.Visible = False
DoCmd.OpenForm frmIvSurvDE
End If
*****

... but it doesn't seem to take.

To have the Form2 form always open to a particular control, either:
1) Set that control's Tab Index to 0.
(or set the form's Tab Order in the Tab Order Dialog. Click on View +
Tab Order)
or..

2) Code Form2's Load event:
Me.[ControlName].SetFocus

When switching back and forth between two open, but
alternately visible forms, is there a way to get the focus
to move to a certain field every time one or the other form
becomes visible? So far, all my attempts have not worked. I
seem to be needing an "on visible" event.
 
When switching back and forth between two open, but
alternately visible forms, is there a way to get the focus
to move to a certain field every time one or the other form
becomes visible? So far, all my attempts have not worked. I
seem to be needing an "on visible" event.


Dawn just broke over marblehead.

On my form-change button, I save the record and move the
focus to the desired control *before* doing the
invisible/visible stuff. That seems to be working well.

Thanks for all your replies, Fred.
 
Back
Top