Access 2013 The Command or Action 'Quit' isn't available now.

I have a program that I run nightly that was originally done in Access 2003. When I run it under Access 2013 or run it converted to an Access 2013 program I get the same message. Which is : The Command or Action 'Quit' isn't available now.  I am using the docmd.quit to exit access altogether. I have moved the command to as many places as I think will access it to run but still get the same error message. It used to run fine.  I have enabled macros to run from the trust center also.  I am at a lost to know what to do to fix it. I am beginning to think that it is a problem in Access 2013 VBA. Any help would be greatly appreciated.
dlord54Asked:
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.

ThommyCommented:
Invoke command "CloseDataBase" before calling "Quit"
0
dlord54Author Commented:
Doesn't that kill the ability to call the Quit command?
0
ThommyCommented:
I don't think so, but simply try it out...
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

dlord54Author Commented:
I tried invoking the "CloseDatabase" before calling "Quit" but it does what I thought it would, It closes the database and leaves Access open. Is there a place I should put it to insure that it will work?
0
Gerwin Jansen, EE MVETopic Advisor Commented:
Can you try: Application.Quit
0
dlord54Author Commented:
I have done that too.
0
Gerwin Jansen, EE MVETopic Advisor Commented:
Strange, just tried that and it works on my end.
0
dlord54Author Commented:
I have created a function that I call using application.quit. It works to the extent that Access closes but the debug window is left open and the line of code application.quit is highlighted. I am not sure what you all are doing  different to make it  work.
0
Gerwin Jansen, EE MVETopic Advisor Commented:
Just this:

Private Sub Command1_Click()
  Application.Quit
End Sub

assigned to a button, on pressing, MsAccess closes.
0
dlord54Author Commented:
I have that working. I am try to close Access after running some code. It runs nightly and I want  Access to close when it is done.
0
Gerwin Jansen, EE MVETopic Advisor Commented:
I understand what you want, in my case Access _is_ closing, did you try clearing all break points?

Any auto-close macro's that may block the Quit command?
0
dlord54Author Commented:
What do you mean by breakpoints? Basically I close the recordset that I have been using and the I want to quit Access.
rst.close
application.quit
0
Jacques Bourgeois (James Burger)PresidentCommented:
Does it work if you press F8 to execute the line when the debugger falls onto it? I have often seen situations where a breakpoint stays there even if you remove it and the indicator does not appear in the margin. This situation usually goes away by itself after a while. If not, you can simply copy the code, delete it, close and restart Access and then paste the code back in.

If this is not your problem, does Access stop normally if you close it manually after your call to Quit does not work?
If not, then you might have something that is still running, possibly an endless or very long loop.
0
ste5anSenior DeveloperCommented:
The normal cause for this error message means that you're already in a event handling process. Depending on the event, certain actions are not available.

So the question is, how and where do you try to call your Quit?
0

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
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
Office Productivity

From novice to tech pro — start learning today.