Dialog box stays on top of form

G

Guest

On a form called "Menu" one of the selections is Rolodex Menu. When the user
selects Rolodex Menu it opens a dialog box. The user than selects one of
four options on the Rolodex Menu like "search" and another dialog box opens
to allow the user to enter "criteria" while the "search" dialog box closes.
Everything to this point works fine. The "criteria" dialog box opens the
"rolodex form" , the "criteria" dialog closes and the "search" dialog box
reappears on top of all the forms. How do I get the "search" dialog to
disappear while I'm looking at the "rolodex form"?
I would like the user return to the "Rolodex Menu" dialog box only when they
click the close button on my "criteria" dialog form so they can make other
selections.
 
G

Guest

In the button click event you open a window something like this:
Me.Visible = False
DoCmd.OpenForm "frmEst", _
DataMode:=acFormEdit, _
WindowMode:=acWindowNormal, _
OpenArgs:=Me.Name

In the top part of "frmEst" define:
Private ParentForm As Form
Private ParentFormName As Variant
Property Set ParentObject(fValue As Form)
Set ParentForm = fValue
ParentFormName = ParentForm.Name
End Property
In the onLoad event for "frmEst" have something like:
If Not IsNull(Me.OpenArgs) Then
Set ParentObject = Application.Forms(Me.OpenArgs)
End If
Then in the onClose event:
Private Sub cmdClose_Click()
If Not ParentForm Is Nothing Then
ParentForm.Visible = True ' or put a call to a property in the
parent to requery
End If
DoCmd.Close acForm, Me.Name, acSaveNo
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top