After launching access from excel, I stop getting normal warning messages "Do you want to save changes"
Posted on 2009-04-21
I use the following code to launch Access from Excel.
Lpath = "c:\myDB.mdb"
Set AccApp = CreateObject("Access.Application")
AccApp.docmd.setwarnings True '<==== THIS DOES NOT WORK EITHER
AccApp.Visible = True
AccApp.Application.Run "startupFromExcel" ' call a procedure named "startupFromExcel".
Accapp.DoCmd.SetWarnings True '<===THIS DOES NOT WORK EITHER
In most respects the resulting Access instance works just as if it was launched from a normal desktop icon.
I can make typical development modifications, like changing a form or a query.
The only problem is that the Access instance acts as if I am running under docmd.setwarnings False.
Every time I close a query, it is saved without the "do you want to save changes" warning.
Does anybody have any suggestions of how to rectify this automatically.
For instance, I tried putting the following code into my Excel and Access modules, BUT THEY DO NOT WORK I still do not get warning messages.
docmd.setwarnings true 'DOES NOT WORK
Even if I close Access, then reopen it manually, the docmd.setwarnings False persists.
The only way to rectify things is to close Access, then use task manager to kill all instances of Access, then reopen Access.
This is very annoying, because it causes me to accidentally make changes to things without realizing it.
I considered having my excel macro automatically kill every existing Access process, but that will not help much, and it strikes me as a little dangerous.
Hope someone can come up with an answer.