We help IT Professionals succeed at work.
Get Started

Closing all forms in Access

John Sheehy
John Sheehy asked
on
340 Views
Last Modified: 2015-04-24
I am updating one of my apps and I want to make one process very simple.

I have many forms.  And they don't all open at once.  But I am so tired of typing the same code for closing the form.  Since they all do the same thing.

I want to be able to write a function that I can refer to in the form for closing that form and opening the main form.

This is what all my close buttons code looks like

DoCmd.Close
DoCmd.Openform "frm-MainSwitchboard", acNormal.

I type this so many times and if the main form changes I have to go back in and update all those modules.

I just want one function that does the same except it is generic and will close the opened form that has the focus..  I do have three forms that open but are hidden.  They need to stay that way.

Any thoughts?
John
Comment
Watch Question
CERTIFIED EXPERT
Top Expert 2016
Commented:
This problem has been solved!
Unlock 1 Answer and 29 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE