|
|
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?
-- Thanks, croy
|
|
On Thu, 06 Nov 2008 10:02:33 -0800, croy wrote:
[Quoted Text] > 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.
-- Fred Please respond only to this newsgroup. I do not reply to personal e-mail
|
|
On Thu, 6 Nov 2008 10:31:51 -0800, fredg <fgutkind[ at ]example.invalid> wrote:
[Quoted Text] >On Thu, 06 Nov 2008 10:02:33 -0800, croy wrote: > >> 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.
Thanks Fred. That seems to work very well.
-- croy
|
|
On Thu, 6 Nov 2008 10:31:51 -0800, fredg <fgutkind[ at ]example.invalid> wrote:
[Quoted Text] >On Thu, 06 Nov 2008 10:02:33 -0800, croy wrote: > >> 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.
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.
-- croy
|
|
On Mon, 10 Nov 2008 11:53:33 -0800, croy wrote:
[Quoted Text] > On Thu, 6 Nov 2008 10:31:51 -0800, fredg > <fgutkind[ at ]example.invalid> wrote: > >>On Thu, 06 Nov 2008 10:02:33 -0800, croy wrote: >> >>> 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. > > 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 -- Fred Please respond only to this newsgroup. I do not reply to personal e-mail
|
|
On Mon, 10 Nov 2008 13:16:17 -0800, fredg <fgutkind[ at ]example.invalid> wrote:
[Quoted Text] >>>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. > >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.
-- croy
|
|
On Wed, 12 Nov 2008 08:00:52 -0800, croy <croy[ at ]invalid.net> wrote:
[Quoted Text] >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.
-- croy
|
|
|