Macros to close a form in active window when another one is open

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to Access and I wanted to know if there is way to close an active
form when another is open. I have multiple forms in a database and would like
only one opened at a time.

Any suggestions. I know I need a macro but I don't know how to do it.

Thanks for any feedback
 
hi,
I used this code behind a lable with a picture on it to
close the main switchboard and open up the sell form.

Private Sub lblSell_DblClick(Cancel As Integer)

DoCmd.OpenForm "frmSell"

DoCmd.Close acForm, "frmMainIntro", acSaveNo

End Sub

on the frmSell form i have a button that closes frmSell
and opens frmMainIntro. same sub, different name with the
form names reversed.
 
Charisse,

As far as I know, this is not possible with a macro.

It could be done with VBA procedures. For example, you could put code
on the Open event of every form to close any already open forms.
However, it depends a bit how you are going about opening your forms...
Do you have some sort of switrchhboard/menu form that is used to control
navigation and processes within your application? If so, you obviously
don't want this one to be closed. To be honest, I wonder whether this
is really a good idea. In my experience, there are many times when you
want to be able to open one form from another, and have the first one
still open for you to return to when the subsequent one is finished
with. In my databases, I virtually never allow access to more than one
form at a time. This is done by setting the Modal property of the form
to Yes. But there are often instances where more than one form is
actually loaded.
 
Back
Top