Solved

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

Posted on 2014-10-07
15
869 Views
Last Modified: 2014-10-14
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.
0
Comment
Question by:dlord54
  • 6
  • 4
  • 2
  • +2
15 Comments
 
LVL 19

Expert Comment

by:Thommy
ID: 40367966
Invoke command "CloseDataBase" before calling "Quit"
0
 

Author Comment

by:dlord54
ID: 40368208
Doesn't that kill the ability to call the Quit command?
0
 
LVL 19

Expert Comment

by:Thommy
ID: 40368239
I don't think so, but simply try it out...
0
 

Author Comment

by:dlord54
ID: 40369001
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
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 40369288
Can you try: Application.Quit
0
 

Author Comment

by:dlord54
ID: 40369321
I have done that too.
0
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 40369485
Strange, just tried that and it works on my end.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:dlord54
ID: 40376993
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
 
LVL 37

Assisted Solution

by:Gerwin Jansen
Gerwin Jansen earned 250 total points
ID: 40377374
Just this:

Private Sub Command1_Click()
  Application.Quit
End Sub

assigned to a button, on pressing, MsAccess closes.
0
 

Author Comment

by:dlord54
ID: 40377410
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
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 40378146
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
 

Author Comment

by:dlord54
ID: 40378306
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
 
LVL 40
ID: 40378414
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
 
LVL 33

Accepted Solution

by:
ste5an earned 250 total points
ID: 40379362
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

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now