Access 2007 - the command or action 'quit' isn't available now

A

Ally Z

I have some Access programs in 2003 and need to migrate to 2007. I developed
some macros in 2003 and the macros will close the Access database at the end
with the Quit command, it is all working fine in 2003, but after migrating it
to 2007, it no longer works and I am getting the error message as below. I
also tried using RunCommand -> Exit, and got the same error message too.

My purpose is to have the Access database automatically close at the end of
the macro. Does anyone know how to solve this issue?

******************************************
The command or action 'Quit' isn't available now.
*You may be in a read-only database or an unconverted database from asn
earlier version of Microsoft Office Access.
*The type of object the action applies to isn't currently selected or isn't
in the active view.
Use only those commands and macro actions that are currently available for
this database.
******************************************
 
S

Steve Schapel

Ally,

Have you set up the Access 2007 database in a Trusted Location?

--
Steve Schapel, Microsoft Access MVP


Ally Z said:
I have some Access programs in 2003 and need to migrate to 2007. I
developed
some macros in 2003 and the macros will close the Access database at the
end
with the Quit command, it is all working fine in 2003, but after migrating
it
to 2007, it no longer works and I am getting the error message as below. I
also tried using RunCommand -> Exit, and got the same error message too.

My purpose is to have the Access database automatically close at the end
of
the macro. Does anyone know how to solve this issue?

******************************************
The command or action 'Quit' isn't available now.
*You may be in a read-only database or an unconverted database from asn
earlier version of Microsoft Office Access.
*The type of object the action applies to isn't currently selected or
isn't
in the active view.
Use only those commands and macro actions that are currently available for
this database.
******************************************



__________ Information from ESET Smart Security, version of virus signature database 4206 (20090701) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
A

Ally Z

Hi Steven,

I added the file pathes to the trust center using "Adding new location", but
I am not sure if I did right. My databases are located on company's Intranet
file server, for example the database is located at
\\fileserver\access_automation\Ally Files\METRICS, then I added this path to
the server to the trust center.

Should add the full path including the file name to the trust center?

thanks for your help
 
S

Steve Schapel

Hi Ally,

No, looks like you did it correctly. You are setting the folder as the
trusted location, so no need to reference individual files.

However, in the trusted locations dialog, there is a checkbox near the
bottom that says 'Allow trusted locations on my network'. Since you are
setting this up on a file server (which, ideally, you probably shouldn't
be), you may need to tick that box.

--
Steve Schapel, Microsoft Access MVP


Ally Z said:
Hi Steven,

I added the file pathes to the trust center using "Adding new location",
but
I am not sure if I did right. My databases are located on company's
Intranet
file server, for example the database is located at
\\fileserver\access_automation\Ally Files\METRICS, then I added this path
to
the server to the trust center.

Should add the full path including the file name to the trust center?



__________ Information from ESET Smart Security, version of virus signature database 4211 (20090702) __________

The message was checked by ESET Smart Security.

http://www.eset.com
 
A

Ally Z

hi Steve,

Actually I did check thebox for ''Allow trusted locations on my network',
and also listed my file server path to the User Locations, but it is still
not working.

any idea?

thanks,
 
J

John M

I am having the same problem with Quit and Set Warnings. I added the folder
where the database resides on C:\ to the trusted locations and it still will
not work.
 
Joined
Jun 30, 2010
Messages
1
Reaction score
0
ARGGGH Same problem.

I've tried SetWarnings off. I've tried everything I can think of but it keeps giving me the same issue when I want to quit.
 
Joined
Aug 21, 2010
Messages
1
Reaction score
0
Hi,

I haven't found anything useful on this topic after about two hours of searching. What I do know I do know is that (in MS Access 2007) you can write a macro or VBA which exits the database w/o returning this error. Problem is that, when running in some other contexts, the error pops up again. I'm too lazy to try to figure out why but here is a workaround which seems to be working or me so far for a scenario in which I want a macro to run then close the database ( and MS Access) after it is finished. The basic idea is to create a wrapper macro to call the workhorse macro then the exit macro.

1. Macro1 = Workhorse macro = the stuff you wanted to get done.
2. Macro2 = The exit macro = runcommand/Quit or Exit
3. Macro3 = Wrapper macro = runmacro Macro1 then runmacro Macro2

Something about a parent macro calling the other two seems to set the context back to where it needs to be before exiting. I'm sure this could be accomplished with code too but have no idea what that would look like.

Hope this works for you.

Regards,

Keith
 
Joined
Feb 10, 2012
Messages
1
Reaction score
0
I had the same issue using a 2003 mdb in 2010. I solved it this way:

I created a Function in a Module named xxxQuit() that had the single line
DoCmd.Quit acQuitSaveAll
where xxx was related to the module's function, but you could probably use AccessQuit() or something similar. I didn't want to use just Quit.

Then in your macro change the QuitAccess "command" to a RunCode command with the xxxQuit() function.
 
Joined
Dec 12, 2012
Messages
1
Reaction score
0
I have the same issue on 2 different 2000 databases in Access 2010. The errors just started occuring so I'm thinking that it was caused by a recent Microsoft patch. After searching and not finding any answers that fixed my issue, I found a solution.


I use Windows Task Scheduler to run a vb script. The VB script launches the database and starts a macro -- /x command. This is superior to an AutoRun Macro which might accidentally run when you don't intend it if you do not hold down the shift key. The macro then launches a VB function which contains my code. At the end of the function I use Docmd.Quit to close Access. This has worked for me on different versions of Access for the last 12 years. Now all of a sudden it no longer works. I get a run time error 2046, the command or action Quit isn't available now.

Here is the solution: precede Docmd.Quit with DoCmd.CloseDatabase. Your new code should look like this:


DoCmd.CloseDatabase
DoCmd.Quit


If you prefer you can also do this from a macro. You macro should look something like this:


Some Macro Functions
RunMenuCommand: CloseDatabase
QuitAccess
 
Joined
Mar 5, 2018
Messages
1
Reaction score
0
I do not see a satisfactory solution here so I thought I'd add one that seems to have solved the problem. My application was written many years ago, probably in Access 97 so I originally thought the problem had to do with the migration to Access 2010. I tried the solutions posted here with no success. So I dug in and found that if I switched off the autoexec macro and instead started it with a form using the current database setting in Options, the docmd.quit works without fail.

I suspect you would not see this problem if the form passed control to another form that closed the initial form and then closed the application, but that seemed like busy work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top