Macro won't allow me to quit Access (1 Viewer)

Alc

Registered User.
Local time
Today, 04:38
Joined
Mar 23, 2007
Messages
2,407
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.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 08:38
Joined
Feb 19, 2013
Messages
16,553
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.
 

isladogs

MVP / VIP
Local time
Today, 08:38
Joined
Jan 14, 2017
Messages
18,186
I also don't use macros but check the macro settings in the Trust Centre



Make sure this is set as 'Enable All Macros'
 

Attachments

  • Capture.PNG
    Capture.PNG
    13.7 KB · Views: 2,432

Alc

Registered User.
Local time
Today, 04:38
Joined
Mar 23, 2007
Messages
2,407
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

Registered User.
Local time
Today, 04:38
Joined
Mar 23, 2007
Messages
2,407
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

Registered User.
Local time
Today, 04:38
Joined
Mar 23, 2007
Messages
2,407
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.
 

Minty

AWF VIP
Local time
Today, 08:38
Joined
Jul 26, 2013
Messages
10,353
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.
 

Alc

Registered User.
Local time
Today, 04:38
Joined
Mar 23, 2007
Messages
2,407
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.
 

Attachments

  • SetProcesses.accdb
    364 KB · Views: 267

Alc

Registered User.
Local time
Today, 04:38
Joined
Mar 23, 2007
Messages
2,407
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.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 08:38
Joined
Feb 19, 2013
Messages
16,553
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
 

Alc

Registered User.
Local time
Today, 04:38
Joined
Mar 23, 2007
Messages
2,407
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.
 

dubi

New member
Local time
Today, 03:38
Joined
Jun 8, 2018
Messages
1
Did you resolve this problem?

I have it too!
 

Users who are viewing this thread

Top Bottom