Refer to most recently opened

jkearns

New member
Local time
Today, 08:07
Joined
Jul 20, 2002
Messages
5
SHORT VERSION:
When this particular form button is clicked, I would like it to find the most recently opened form (or the one that is currently visible, or last had focus, or 'in front') and close it. IS THERE CODE??

LONG VERSION:
I have a subform (sfNavbar) that appears on all forms which allow it. It contains navbar kind of stuff and a DONE button. With Continuous Forms I must use sfNavbar as a fixed modal window instead of a subform.

When the DONE button is pressed I can determine whether it is a subform by its tag, and if so close the parent form.

When it's a modal window, I want it to find the most recently opened form (or the one that is currently visible, or last had focus, or 'in front') and close it. Other forms may be open behind it.

I can instruct the code to determine whether a form is currently open with acSysCmdGetObjectState, but alas, that's not enough.

Is it possible to fix a background constant/variable that changes as different forms are opened or focused upon?
 
When you open a form pass it the current form's name in the OpenArgs argument of the OpenForm method. Then the modal form can reference the OpenArgs to determine which form opened it.

To pass a form name as the OpenArgs argument:
DoCmd.OpenForm "YourFormName", , , , , , Me.Name

To reference the OpenArgs argument:
DoCmd.OpenForm Me.OpenArgs
 

Users who are viewing this thread

Back
Top Bottom