Your kind assistance please.
In the interest of reducing the amount of forms I have on
screen any any given time, is it possible to go back to
the last form that was open after the present form has
been shut down.
In my db i have many docmd.open form with were conditions,
which all work fine. The problem is I seem to have alot of
forms on screen with one on top of another. This can start
to look messy and confusing for the user.
If anyone can point me in the right direction, I would be
greatful.
Regards PaulW.
DoCmd.OpenForm "Form2Name", , , , , , Me.Name
DoCmd.Close acForm, Me.Name
Then when you close that 2nd form you can go back to the first form
by coding the 2nd form's Close event:
DoCmd.OpenForm Me.OpenArgs
--
Fred
Please reply only through this newsgroup.
I do not reply to direct e-mails.
PaulW <to...@nyspammers.com> wrote in message
news:1a85e01c230ee$480322f0$9ae62ecf@tkmsftngxa02...
I created a Class Module called Module1 with the following
code. Notice the Global variable declaration:
---begin code sample---
Option Compare Database
Option Explicit
Global strFormName As String
Public Sub FormName()
strFormName = Screen.ActiveForm.Name
End Sub
---end sample---
Then in the On Close event of your first form you can add
the code:
Module1.FormName
which stores the current form name as a variable.
In the On Close event of any subsequent forms, use the code
DoCmd.OpenForm strFormName
Me.SetFocus
Module1.FormName
which will open up the form whose name is now stored
memory and then store the current form's name.
I don't know how clear that explanation is. Repost if you
have questions.
Also, there may be an easier/better way, but this one
works.
>.
>
Thanks guys.
To pass the current form name:
DoCmd.OpenForm "YourFormName",,,,,,Me.Name
To go back to the form that opened this one:
DoCmd.OpenForm Me.OpenArgs
>.
>