Go Back   Access World Forums > Microsoft Access Discussion > Macros

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-10-2017, 10:18 AM   #1
Alc
Newly Registered User
 
Join Date: Mar 2007
Posts: 2,243
Thanks: 43
Thanked 26 Times in 25 Posts
Alc will become famous soon enough Alc will become famous soon enough
Macro won't allow me to quit Access

I have a number of macros in a number of databases. The last action in each one is QuitAccess. These are all scheduled to run overnight and used to work fine. Lately, we've added a new PC and - if run on the new PC - each macro now fails on the QuitAccess step, with the error message:
Code:
The command or action 'Quit' isn't available now.
* You may be in a read-only database or an unconverted database from an earlier version of Microsoft 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.
I created a very much simplified version of the macro for testing purposes and was able to identify that specific line as the problem. The new macro contains just one Action (QuitAccess) and exactly the same thing happens.

1. If I right click on the closed macro and choose 'Run' I get the above error message
however
2 If I open the macro in design view and click on the red 'Run' exclamation mark, it completes as expected and shuts down the database.

The QuitAccess action within the macro has the yellow 'Unsafe Action' next to it, in spite of the database being in a folder that's a trusted location. I've made sure the database is in a trusted folder and that the message bar is set to be displayed when active content has been blocked (it isn't being displayed).

I turned on Trust Center Logging and the last line in the produced file when I open the database is:
Trust Center Decision: Enable Content

I've tried removing the QuitAccess action and instead call a function that just contains 'DoCmd.Quit' but I get the same message.

I've tried using all three options for QuitAccess (Exit, Prompt and Save All) and all three options for DoCmd.Quit (acSaveYes, acSaveNo and acSavePrompt). The results are the same.

From the 'clutching at straws' playbook, I checked the Access version and found that while both machines are running Access 2010, the PC I usually use has the Version: 14.0.7113.5005 while the 'faulty' one has Version: 14.0.6023.1000. This may be a complete red herring but I mention it just in case.

Alc is offline   Reply With Quote
Old 08-10-2017, 12:07 PM   #2
CJ_London
Super Moderator
 
Join Date: Feb 2013
Location: UK
Posts: 9,617
Thanks: 37
Thanked 3,116 Times in 3,025 Posts
CJ_London is a jewel in the rough CJ_London is a jewel in the rough CJ_London is a jewel in the rough
Re: Macro won't allow me to quit Access

version 14 is 2010 - running windows updates should bring both into line but is unlikely to be the reason for your problem.

I don't use macros so cannot really advise.
__________________
CJ_London
_______________________
A little thanks goes a long way. If you have found this post useful, please tick the thanks button
CJ_London is offline   Reply With Quote
Old 08-10-2017, 12:31 PM   #3
ridders
AWF VIP
Gold Supporter
 
ridders's Avatar
 
Join Date: Jan 2017
Location: Somerset, UK
Posts: 2,889
Thanks: 52
Thanked 680 Times in 628 Posts
ridders has a spectacular aura about ridders has a spectacular aura about
Re: Macro won't allow me to quit Access

I also don't use macros but check the macro settings in the Trust Centre



Make sure this is set as 'Enable All Macros'
Attached Images
File Type: png Capture.PNG (13.7 KB, 184 views)

__________________
Colin
Access 2010 32-bit, Access 2016 32-bit & 64-bit, SQL Server Express 2014, Windows 10,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
,
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
, Tapatalk


If this answer has helped, please click the Thanks button and/or click the 'reputation' scales symbol on the left and leave a comment. Cheers!
ridders is offline   Reply With Quote
Old 08-11-2017, 03:52 AM   #4
Alc
Newly Registered User
 
Join Date: Mar 2007
Posts: 2,243
Thanks: 43
Thanked 26 Times in 25 Posts
Alc will become famous soon enough Alc will become famous soon enough
Re: Macro won't allow me to quit Access

Quote:
Originally Posted by CJ_London View Post
version 14 is 2010 - running windows updates should bring both into line but is unlikely to be the reason for your problem.

I don't use macros so cannot really advise.
Thanks. I didn't think that was causing it but I'm at the 'getting desperate' stage now, where I come in every morning to a dozen Access windows left open. I was just trying to find some difference between the two PCs.
Alc is offline   Reply With Quote
Old 08-11-2017, 03:52 AM   #5
Alc
Newly Registered User
 
Join Date: Mar 2007
Posts: 2,243
Thanks: 43
Thanked 26 Times in 25 Posts
Alc will become famous soon enough Alc will become famous soon enough
Re: Macro won't allow me to quit Access

Quote:
Originally Posted by ridders View Post
I also don't use macros but check the macro settings in the Trust Centre



Make sure this is set as 'Enable All Macros'
Changed the settings but made no difference.
Thanks for the suggestion.
Alc is offline   Reply With Quote
Old 08-11-2017, 03:55 AM   #6
Alc
Newly Registered User
 
Join Date: Mar 2007
Posts: 2,243
Thanks: 43
Thanked 26 Times in 25 Posts
Alc will become famous soon enough Alc will become famous soon enough
Re: Macro won't allow me to quit Access

I assume it's connected but the VBA command to quit doesn't work on the database either. 'Application.Quit' produces the error message
Code:
Run-time error '2046':
The command or action 'Quit' isn't available now.
Alc is offline   Reply With Quote
Old 08-11-2017, 04:07 AM   #7
Minty
AWF VIP
 
Minty's Avatar
 
Join Date: Jul 2013
Location: UK - Wiltshire
Posts: 4,646
Thanks: 97
Thanked 1,271 Times in 1,244 Posts
Minty has a spectacular aura about Minty has a spectacular aura about
Re: Macro won't allow me to quit Access

I think your version differences are probably the problem. Get the windows /office updates done on the "Faulty" pc.
We've had weird faults on single machines that have been down to an update not being in place.

__________________
A little thanks goes a long way
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

(Please use the scales on the left if we have helped!) Mark threads as Solved once you have an answer.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.


To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Minty is offline   Reply With Quote
Old 08-11-2017, 04:11 AM   #8
Alc
Newly Registered User
 
Join Date: Mar 2007
Posts: 2,243
Thanks: 43
Thanked 26 Times in 25 Posts
Alc will become famous soon enough Alc will become famous soon enough
Re: Macro won't allow me to quit Access

I've attached the database I'm testing with.

For the macro 'mcrProcesses':
1. Right-click and choose Run - error message
2. Go to Database Tools - Run macro - works
3. Open in design view and click on Run - works

The scheduler we're using (from here http://www.theaccessweb.com/resources/downloads.htm) appears to be running the macro in the same way as option 3, resulting in the same error.
Attached Files
File Type: accdb SetProcesses.accdb (364.0 KB, 16 views)
Alc is offline   Reply With Quote
Old 08-11-2017, 04:22 AM   #9
Alc
Newly Registered User
 
Join Date: Mar 2007
Posts: 2,243
Thanks: 43
Thanked 26 Times in 25 Posts
Alc will become famous soon enough Alc will become famous soon enough
Re: Macro won't allow me to quit Access

Quote:
Originally Posted by Minty View Post
I think your version differences are probably the problem. Get the windows /office updates done on the "Faulty" pc.
We've had weird faults on single machines that have been down to an update not being in place.
Thanks.

'Change Request' submitted to the IT support people. Unfortunately, they have been known to drag their feet. We shall see.
Alc is offline   Reply With Quote
Old 08-11-2017, 05:25 AM   #10
CJ_London
Super Moderator
 
Join Date: Feb 2013
Location: UK
Posts: 9,617
Thanks: 37
Thanked 3,116 Times in 3,025 Posts
CJ_London is a jewel in the rough CJ_London is a jewel in the rough CJ_London is a jewel in the rough
Re: Macro won't allow me to quit Access

just a thought - are both machines using the same front end at the same time? If so, ensure both machines run their own copy of the front end
__________________
CJ_London
_______________________
A little thanks goes a long way. If you have found this post useful, please tick the thanks button
CJ_London is offline   Reply With Quote
Old 08-11-2017, 05:59 AM   #11
Alc
Newly Registered User
 
Join Date: Mar 2007
Posts: 2,243
Thanks: 43
Thanked 26 Times in 25 Posts
Alc will become famous soon enough Alc will become famous soon enough
Re: Macro won't allow me to quit Access

Quote:
Originally Posted by CJ_London View Post
just a thought - are both machines using the same front end at the same time? If so, ensure both machines run their own copy of the front end
There's only one front end, as it can be used by many machines, but only one is ever using it at a time. I know this as I'm the only one who uses it.

Alc is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Cannot Quit Access program either in the code or using a macro KSP Modules & VBA 11 10-03-2014 11:09 PM
Access Quit Command not working in Macro Faray Macros 2 02-12-2012 08:41 AM
Access 2007 Quit macro action problem Wayne Cramer Macros 3 02-27-2009 06:00 AM
Access 2007 Quit macro action problem Wayne Cramer Queries 0 02-25-2009 07:10 AM
Quit Macro Ligaya Macros 1 05-03-2007 02:43 AM




All times are GMT -8. The time now is 01:08 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World