Hoping for short cut key to close vba windows in Access

I'm getting so tired of x' ing out of all of those visual basic windows in MS Access code view.
Had the same problem with A2K.. now using Office 365... have they added a function key or key shortcut for this yet???
I can't believe you experts deal with this problem..do you?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If your app keeps dropping into code windows, it is because you are not trapping errors correctly.  From the VBA window, go to Tools/Options and look at the error trapping setting on the General Tab.  Mine is set to break on unhandled errors.   As I discover potential errors, I either fix them permanently if my code is the problem or add handlers to give users help in recovering from the problem without dropping into code.
crystal (strive4peace) - Microsoft MVP, AccessRemote Training and ProgrammingCommented:
here is some code you can use to close open modules in VBA:

VBA > Module > Close Open Windows

Daniel PineaultPresident / Owner CARDA Consultants Inc.Commented:
How exactly does it impact you if another window is open underneath the one you are working on?  If they are maximized, you only see the one you are working on.  I guess I'm just used to it.

Regardless, Mz-Tools add-in has a close all modules button amongst many other very valuable commands, definitely worth the price.

If you just want code, try
 Public Sub VBE_CloseAllModules(_
     Dim i As Integer
     Dim mods As Modules
     Set mods = Application.Modules
     For i = mods.count - 1 To 0 Step -1
         DoCmd.Close acModule, mods(i).Name, acSaveYes
     Next i
 End Sub

Open in new window

Price Your IT Services for Profit

Managed service contracts are great - when they're making you money. Yes, you’re getting paid monthly, but is it actually profitable? Learn to calculate your hourly overhead burden so you can master your IT services pricing strategy.

Gustav BrockCIOCommented:
Press and hold down Ctrl+F4.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Daniel PineaultPresident / Owner CARDA Consultants Inc.Commented:
Nice little trick Gustav!
pcalabriaAuthor Commented:
Thanks!  It closes the windows one at a time but sure beats using the mouse!!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.