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:
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
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.