Hi,
I've come across a strange problem in a new contract, wondering if anyone else has discovered the cause or solution.
My client has a series of Access databases that are managed through Windows Task Scheduler on some dedicated desktop PCs. Task scheduler opens each database on a frequent schedule, and runs the main macro in each to export data and build reports. After the process is run, the macro calls action QuitAccess to close the Access application.
Using Access 2010 on Windows 7 OS SP1 64 bit 2.4Ghz 8Gb RAM
(It's quite a good system imo in order to get round restrictions they face building a SQL Server automation)
Anyway, I'm carrying out work on the databases, copying them and readying them for a system change, except when I run the macro on one database, I get an error I haven't seen before:
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.
The issue occurs when the macro tries to run action: QuitAccess. It errors regardless of whether Option Exit or Save All is selected.
It is running fine on the original version of the database.
And this is where is gets weird... I've just realised that in testing the changes to the macro, I've been right clicking on it and selecting run. Every time I do that, I get the error. But, when I double click on the macro, it runs and closes Access with no error. :banghead:
Does anyone know why this would be?
I've been through this and other forums searching for explanations, but although quite a few people have experienced the error, there is very little useful advice.
I've tried the suggestion here: https://access-programmers.co.uk/forums/showthread.php?t=165034
However, that just gives a slightly different error:
Run-time error '2046':
The command or action 'Quit' isn't available now.
I'm able to use VBA to close the current database, but that leaves the Access application running and it needs to close.
Looking at this thread: https://www.pcreview.co.uk/threads/access-2007-the-command-or-action-quit-isnt-available-now.3844511/
I've tried placing the QuitAccess action in a different macro and calling it from the main macro process, but that also gives the error.
I've ensured the database is set up as a Trusted Location. SetWarnings is set to Off.
I've created a test Task Scheduler and run a couple of successful tests automating the macro and both times, the application closed without any error.
So to summarise, does anyone know why the error would occur when running a macro by right clicking and selecting run (and also when attempting to quit via VBA), but no error when I double click or automate through Task Scheduler?
I've come across a strange problem in a new contract, wondering if anyone else has discovered the cause or solution.
My client has a series of Access databases that are managed through Windows Task Scheduler on some dedicated desktop PCs. Task scheduler opens each database on a frequent schedule, and runs the main macro in each to export data and build reports. After the process is run, the macro calls action QuitAccess to close the Access application.
Using Access 2010 on Windows 7 OS SP1 64 bit 2.4Ghz 8Gb RAM
(It's quite a good system imo in order to get round restrictions they face building a SQL Server automation)
Anyway, I'm carrying out work on the databases, copying them and readying them for a system change, except when I run the macro on one database, I get an error I haven't seen before:
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.
The issue occurs when the macro tries to run action: QuitAccess. It errors regardless of whether Option Exit or Save All is selected.
It is running fine on the original version of the database.
And this is where is gets weird... I've just realised that in testing the changes to the macro, I've been right clicking on it and selecting run. Every time I do that, I get the error. But, when I double click on the macro, it runs and closes Access with no error. :banghead:
Does anyone know why this would be?
I've been through this and other forums searching for explanations, but although quite a few people have experienced the error, there is very little useful advice.
I've tried the suggestion here: https://access-programmers.co.uk/forums/showthread.php?t=165034
However, that just gives a slightly different error:
Run-time error '2046':
The command or action 'Quit' isn't available now.
I'm able to use VBA to close the current database, but that leaves the Access application running and it needs to close.
Looking at this thread: https://www.pcreview.co.uk/threads/access-2007-the-command-or-action-quit-isnt-available-now.3844511/
I've tried placing the QuitAccess action in a different macro and calling it from the main macro process, but that also gives the error.
I've ensured the database is set up as a Trusted Location. SetWarnings is set to Off.
I've created a test Task Scheduler and run a couple of successful tests automating the macro and both times, the application closed without any error.
So to summarise, does anyone know why the error would occur when running a macro by right clicking and selecting run (and also when attempting to quit via VBA), but no error when I double click or automate through Task Scheduler?