Navigate back to Main Form.

  • Thread starter Thread starter hotrod1952 via AccessMonster.com
  • Start date Start date
H

hotrod1952 via AccessMonster.com

I have two main forms (one used by supervisors & the other used by machine
operators). From both of those forms I open a subform which allows me to
input data for query sort paramaters & generate a report. That all works.
What I would like to do is utilize the OnClose Event of the subform and have
it navigate back to the originating main form which opened it.
 
In your main form(s) you probably have something like the following to
display your child (sub) form:
DoCmd.OpenForm "frm_detail", _
DataMode:=acFormEdit, _
WindowMode:=acWindowNormal, _
OpenArgs:=Me.Name
Add the OpenArgs parameter to pass the name of the calling form to the child.
Include after the OpenForm:
Me.Visible = False
Do NOT close the parent form.

*** In the child form ***
Private ParentForm As Form
Private ParentFormName As Variant

Property Set ParentObject(fValue As Form)
Set ParentForm = fValue
ParentFormName = ParentForm.Name
End Property

Now in the child form onLoad event:

If Not IsNull(Me.OpenArgs) Then
Set ParentObject = Application.Forms(Me.OpenArgs)
End If

In the child form onClose event include:
ParentForm.Visible = True
 
I have two main forms (one used by supervisors & the other used by machine
operators). From both of those forms I open a subform which allows me to
input data for query sort paramaters & generate a report. That all works.
What I would like to do is utilize the OnClose Event of the subform and have
it navigate back to the originating main form which opened it.

I must be missing something here. When you open form "B" from form
"A", form "A" stays open unless you close it, minimize it, hide it,
etc. via code or some other method. Then when you close form "B", form
"A" is still there on your screen.
 
I am closing the origin forms and want to open them back up for this
application.
I have two main forms (one used by supervisors & the other used by machine
operators). From both of those forms I open a subform which allows me to
[quoted text clipped - 4 lines]
I must be missing something here. When you open form "B" from form
"A", form "A" stays open unless you close it, minimize it, hide it,
etc. via code or some other method. Then when you close form "B", form
"A" is still there on your screen.
 
Back
Top